Boost logo

Boost :

From: Emily Winch (emily_at_[hidden])
Date: 2001-11-27 09:11:53


> Then we can create a class
>
> template< class Type, Type value, class Tail >
> class static_const_value_list
> {
> public:
> static const Type head_value = Value;
> typedef Type head_type;
> typedef Tail tail_type;
> class nil {};
> };
>
> template< int Value, class Tail >
> class int_list : public static_const_value_list< int, Value, Tail >
> {
> };
>
> typedef RECURSIVE_5( int_list, 1, 2, 3, 4, 5 ) one_to_five;
>

So long as we put in an assert that head_value and Tail::head_value are the
same type. Otherwise people could make really counterintuitive types by
putting

typedef int_list<3, float_list<4., nil> > my_list; // um?

Unless we _wanted_ a heterogenous compile time value list. Is there a use
for that?

Emily


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk