3 #ifndef DUNE_TYPETRAITS_HH
4 #define DUNE_TYPETRAITS_HH
6 #if defined HAVE_TYPE_TRAITS
8 #elif defined HAVE_TR1_TYPE_TRAITS
9 #include <tr1/type_traits>
39 struct PointerTraits {
40 enum { result =
false };
45 struct PointerTraits<U*> {
46 enum { result =
true };
50 template <
class U>
struct ReferenceTraits
52 enum { result =
false };
56 template <
class U>
struct ReferenceTraits<U&>
58 enum { result =
true };
146 template<
typename T,
bool isVolatile>
158 #if defined HAVE_TYPE_TRAITS
159 using std::remove_const;
160 #elif defined HAVE_TR1_TYPE_TRAITS
161 using std::tr1::remove_const;
173 #if defined HAVE_TYPE_TRAITS
174 using std::remove_reference;
175 #elif defined HAVE_TR1_TYPE_TRAITS
176 using std::tr1::remove_reference;
191 # endif // ! defined(DOXYGEN)
203 template<
class From,
class To>
207 struct Big{
char dummy[2];};
208 static Small test(To);
209 static Big test(...);
215 exists =
sizeof(test(makeFrom())) ==
sizeof(Small),
225 template <
class From>
273 template <
class Base,
class Derived>
279 struct Big{
char dummy[2];};
280 static Small test(RawBase*);
281 static Big test(...);
282 static RawDerived* &makePtr ();
286 value =
sizeof(test(makePtr())) ==
sizeof(Small)
298 template<
class T1,
class T2>
310 #ifdef HAVE_TYPE_TRAITS
311 using std::enable_if;
319 template<
bool b,
typename T=
void>
336 template<
class T1,
class T2,
class Type>
338 :
public enable_if<IsInteroperable<T1,T2>::value, Type>
341 #if defined HAVE_TYPE_TRAITS
343 #elif defined HAVE_TR1_TYPE_TRAITS
344 using std::tr1::is_same;
350 template<
typename T1,
typename T2>
376 template<
bool first,
class T1,
class T2>
388 template<
class T1,
class T2>
398 #if defined HAVE_TYPE_TRAITS
399 using std::integral_constant;
402 #elif defined HAVE_TR1_TYPE_TRAITS
403 using std::tr1::integral_constant;
412 template <
class T, T v>