Blaze  3.6
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 
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 Size_t<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 Size_t<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 Size_t< 1UL + IndexOf< TypeList<Ts...>, T >::value >
116 {};
118 //*************************************************************************************************
119 
120 
121 //*************************************************************************************************
134 template< typename TL // Type of the type list
135  , typename T > // The search type
136 constexpr size_t IndexOf_v = IndexOf<TL,T>::value;
137 //*************************************************************************************************
138 
139 } // namespace blaze
140 
141 #endif
IntegralConstant< size_t, N > Size_t
Compile time integral constant wrapper for size_t.The Size_t alias template represents an integral wr...
Definition: IntegralConstant.h:258
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:72
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
constexpr size_t IndexOf_v
Auxiliary variable template for the IndexOf type trait.The IndexOf_v variable template provides a con...
Definition: IndexOf.h:136
Header file for the TypeList class template.
Header file for the IntegralConstant 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