22 #ifndef _BLAZE_UTIL_TYPELIST_H_
23 #define _BLAZE_UTIL_TYPELIST_H_
130 #define BLAZE_TYPELIST_1( T1 ) \
131 TypeList< T1, NullType >
151 #define BLAZE_TYPELIST_2( T1, T2 ) \
152 TypeList< T1, BLAZE_TYPELIST_1( T2 ) >
172 #define BLAZE_TYPELIST_3( T1, T2, T3 ) \
173 TypeList< T1, BLAZE_TYPELIST_2( T2, T3 ) >
193 #define BLAZE_TYPELIST_4( T1, T2, T3, T4 ) \
194 TypeList< T1, BLAZE_TYPELIST_3( T2, T3, T4 ) >
214 #define BLAZE_TYPELIST_5( T1, T2, T3, T4, T5 ) \
215 TypeList< T1, BLAZE_TYPELIST_4( T2, T3, T4, T5 ) >
235 #define BLAZE_TYPELIST_6( T1, T2, T3, T4, T5, T6 ) \
236 TypeList< T1, BLAZE_TYPELIST_5( T2, T3, T4, T5, T6 ) >
256 #define BLAZE_TYPELIST_7( T1, T2, T3, T4, T5, T6, T7 ) \
257 TypeList< T1, BLAZE_TYPELIST_6( T2, T3, T4, T5, T6, T7 ) >
277 #define BLAZE_TYPELIST_8( T1, T2, T3, T4, T5, T6, T7, T8 ) \
278 TypeList< T1, BLAZE_TYPELIST_7( T2, T3, T4, T5, T6, T7, T8 ) >
298 #define BLAZE_TYPELIST_9( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) \
299 TypeList< T1, BLAZE_TYPELIST_8( T2, T3, T4, T5, T6, T7, T8, T9 ) >
320 #define BLAZE_TYPELIST_10( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) \
321 TypeList< T1, BLAZE_TYPELIST_9( T2, T3, T4, T5, T6, T7, T8, T9, T10 ) >
349 template<
typename TList >
375 template<
typename Head
377 struct Length< TypeList<Head,Tail> >
380 enum { value = 1 + Length<Tail>::value };
413 template<
typename TList
424 template<
typename Head
441 template<
typename Head
447 typedef typename TypeAt< Tail, Index-1 >::Result Result;
483 template<
typename TList
494 template<
typename Type >
510 template<
typename Tail
512 struct Contains< TypeList<Type,Tail>, Type >
527 template<
typename Head
530 struct Contains< TypeList<Head,Tail>, Type >
533 enum { value = Contains<Tail,Type>::value };
572 template<
typename TList
583 template<
typename Type >
599 template<
typename Head
602 struct ContainsRelated< TypeList<Head,Tail>, Type >
607 class Yes { No no[2]; };
611 static Yes test( Head );
612 static No test( ... );
613 static Type createType();
617 enum { tmp =
sizeof( test( createType() ) ) ==
sizeof( Yes ) ? 1 : 0 };
622 enum { value = tmp == 1 ? 1 : ( ContainsRelated<Tail,Type>::value ) };
648 template<
typename TList
659 template<
typename Type >
675 template<
typename Tail
677 struct IndexOf< TypeList<Type,Tail>, Type >
692 template<
typename Head
695 struct IndexOf< TypeList<Head,Tail>, Type >
699 enum { tmp = IndexOf<Tail,Type>::value };
704 enum { value = tmp == -1 ? -1 : 1 + tmp };
734 template<
typename TList
761 template<
typename Type >
777 template< typename Head
794 template<
typename Head
797 struct Append< TypeList<Head,Tail>, Type >
800 typedef TypeList< Head, typename Append<Tail,Type>::Result > Result;