58 #ifndef AMESOS2_META_HPP
59 #define AMESOS2_META_HPP
61 #include "Amesos2_config.h"
78 template <
class T, T val>
79 struct integral_constant
81 typedef integral_constant<T, val> type;
83 static const T value = val;
87 typedef integral_constant<bool, true> true_type;
88 typedef integral_constant<bool, false> false_type;
97 template <
typename,
typename>
98 struct is_same :
public false_type
101 template <
typename T>
102 struct is_same<T,T> :
public true_type
115 template <
bool b1,
bool b2>
116 struct or_ :
public false_type {};
119 struct or_<true,b> :
public true_type {};
122 struct or_<b,true> :
public true_type {};
125 template <
bool b1,
bool b2>
126 struct and_ :
public false_type {};
129 struct and_<true,true> :
public true_type {};
136 struct not_<true> : false_type {};
139 struct not_<false> : true_type {};
146 template <
bool B,
typename T1,
typename T2>
147 struct if_then_else {};
149 template <
typename T1,
typename T2>
150 struct if_then_else<true, T1, T2> {
154 template <
typename T1,
typename T2>
155 struct if_then_else<false, T1, T2> {
166 template <
typename Head,
typename Tail>
168 typedef type_list<Head,Tail> type;
184 template <
typename T1>
186 : type_list<T1,nil_t>
189 template <
typename T1,
typename T2>
191 : type_list<T1,type_list<T2,nil_t> >
194 template <
typename T1,
typename T2,
typename T3>
196 : type_list<T1, type_list<T2, type_list<T3,nil_t> > >
199 template <
typename T1,
typename T2,
typename T3,
typename T4>
201 : type_list<T1, type_list<T2, type_list<T3, type_list<T4,nil_t> > > >
204 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
206 : type_list<T1, type_list<T2, type_list<T3, type_list<T4, type_list<T5,nil_t> > > > >
209 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
211 : type_list<T1, type_list<T2, type_list<T3, type_list<T4, type_list<T5, type_list<T6,nil_t> > > > > >
234 template <
typename list,
typename elem>
235 struct type_list_contains {
236 static const bool value =
237 if_then_else<is_same<typename list::head, elem>::value,
239 type_list_contains<typename list::tail,elem> >::type::value;
243 template <
typename elem>
244 struct type_list_contains<nil_t,elem> {
245 static const bool value =
false;
254 #endif // AMESOS2_META_HPP