Click here to Skip to main content
15,892,746 members
Articles / Programming Languages / C++

STL compliant container example

Rate me:
Please Sign up or sign in to vote.
4.79/5 (7 votes)
9 Aug 2003 57.8K   675   18  
A self explaning example on how to build a fully compliant STL container
#ifndef _TYPEMANIP_HPP_
#define _TYPEMANIP_HPP_
// ****************************************************************************
// CREATED_ON	: 09-07-03
// CREATED_BY	: Martin Lutken
// ****************************************************************************

#include "tutils.h"



_TUTILS_BEGIN_NAMESPACE

/** Class template select. (From loki library, but uses stl naming style here)
	Selects one of two types based upon a boolean constant
	Invocation: select<flag, T, U>::result
	where:
	flag is a compile-time boolean constant
	T and U are types
	Result evaluates to T if flag is true, and to U otherwise.*/
    template <bool flag, typename T, typename U>
    struct select
    {
        typedef T result;
    };
    template <typename T, typename U>
    struct select<false, T, U>
    {
        typedef U result;
    };


_TUTILS_END_NAMESPACE


#endif


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Denmark Denmark
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions