IndexOf.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_TYPELIST_INDEXOF_H_
36 #define _BLAZE_UTIL_TYPELIST_INDEXOF_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/util/mpl/SizeT.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // TYPE LIST SEARCH
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
73 template< typename TL // Type of the type list
74  , typename T > // The search type
75 struct IndexOf;
76 //*************************************************************************************************
77 
78 
79 //*************************************************************************************************
84 template< typename T > // The search type
85 struct IndexOf< TypeList<>, T >
86  : public SizeT<1UL>
87 {};
89 //*************************************************************************************************
90 
91 
92 //*************************************************************************************************
97 template< typename T // The search type
98  , typename... Ts > // Types of the tail of the type list
99 struct IndexOf< TypeList<T,Ts...>, T >
100  : public SizeT<0UL>
101 {};
103 //*************************************************************************************************
104 
105 
106 //*************************************************************************************************
111 template< typename U // Type of the head of the type list
112  , typename... Ts // Types of the tail of the type list
113  , typename T > // The search type
114 struct IndexOf< TypeList<U,Ts...>, T >
115  : public SizeT< 1UL + IndexOf< TypeList<Ts...>, T >::value >
116 {};
118 //*************************************************************************************************
119 
120 } // namespace blaze
121 
122 #endif
Header file for the SizeT class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Implementation of a type list.The TypeList class template represents a list of data types of arbitrar...
Definition: TypeList.h:119
Compile time integral constant wrapper for size_t.The SizeT class template represents an integral wra...
Definition: SizeT.h:72
Header file for the TypeList class template.
Searching a type list.The IndexOf class can be used to search the type list for a particular type Typ...
Definition: IndexOf.h:75