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>
47 struct PointerTraits {
48 enum { result =
false };
53 struct PointerTraits<U*> {
54 enum { result =
true };
58 template <
class U>
struct ReferenceTraits
60 enum { result =
false };
64 template <
class U>
struct ReferenceTraits<U&>
66 enum { result =
true };
154 template<
typename T,
bool isVolatile>
166 #if defined HAVE_TYPE_TRAITS
167 using std::remove_const;
168 #elif defined HAVE_TR1_TYPE_TRAITS
169 using std::tr1::remove_const;
181 #if defined HAVE_TYPE_TRAITS
182 using std::remove_reference;
183 #elif defined HAVE_TR1_TYPE_TRAITS
184 using std::tr1::remove_reference;
199 # endif // ! defined(DOXYGEN)
211 template<
class From,
class To>
215 struct Big {
char dummy[2];};
216 static Small test(To);
217 static Big test(...);
223 exists =
sizeof(test(makeFrom())) ==
sizeof(Small),
233 template <
class From>
281 template <
class Base,
class Derived>
287 struct Big {
char dummy[2];};
288 static Small test(RawBase*);
289 static Big test(...);
290 static RawDerived* &makePtr ();
294 value =
sizeof(test(makePtr())) ==
sizeof(Small)
306 template<
class T1,
class T2>
318 #ifdef HAVE_TYPE_TRAITS
319 using std::enable_if;
327 template<
bool b,
typename T=
void>
344 template<
class T1,
class T2,
class Type>
346 :
public enable_if<IsInteroperable<T1,T2>::value, Type>
349 #if defined HAVE_TYPE_TRAITS
351 #elif defined HAVE_TR1_TYPE_TRAITS
352 using std::tr1::is_same;
358 template<
typename T1,
typename T2>
386 template<
bool first,
class T1,
class T2>
398 template<
class T1,
class T2>
404 #if DOXYGEN || !HAVE_STD_CONDITIONAL
417 template<
bool first,
class T1,
class T2>
429 template<
class T1,
class T2>
435 #else // DOXYGEN || !HAVE_STD_CONDITIONAL
438 using std::conditional;
440 #endif // DOXYGEN || !HAVE_STD_CONDITIONAL
446 #if HAVE_INTEGRAL_CONSTANT
447 using std::integral_constant;
450 #else // #if HAVE_INTEGRAL_CONSTANT
456 template <
class T, T v>
472 #endif // #else // #if HAVE_INTEGRAL_CONSTANT
503 template<
typename _Tp>
507 template<
typename _Tp>
516 template<
typename _Tp>
T type
Definition: typetraits.hh:330
#define DUNE_DEPRECATED
Mark some entity as deprecated.
Definition: deprecated.hh:84
integral_constant< T, v > type
type of this class itself
Definition: typetraits.hh:463
Whether the conversion exists in both ways.
Definition: typetraits.hh:225
Definition: typetraits.hh:490
const UnqualifiedType ConstType
Definition: typetraits.hh:130
Just an empty class.
Definition: typetraits.hh:30
Definition: typetraits.hh:364
Compile time test for testing whether two types are the same.
Definition: typetraits.hh:359
T UnqualifiedType
Definition: typetraits.hh:129
const UnqualifiedType ConstType
Definition: typetraits.hh:107
Tests wether a type is constant.
Definition: typetraits.hh:146
const volatile UnqualifiedType ConstVolatileType
Definition: typetraits.hh:120
Definition: typetraits.hh:74
PointerTraits< T >::PointeeType PointeeType
Definition: typetraits.hh:72
Checks wether a type is convertible to another.
Definition: typetraits.hh:212
True if the conversion exists.
Definition: typetraits.hh:223
integral_constant< bool, false > false_type
type for false
Definition: typetraits.hh:471
const UnqualifiedType ConstType
Definition: typetraits.hh:119
Tests wether a type is volatile.
Definition: typetraits.hh:136
True if T has a const qualifier.
Definition: typetraits.hh:89
T type
T with references removed.
Definition: typetraits.hh:193
const volatile UnqualifiedType ConstVolatileType
Definition: typetraits.hh:131
True if The type is constant.
Definition: typetraits.hh:150
integral_constant< bool, true > true_type
type for true
Definition: typetraits.hh:469
Conversion()
Definition: typetraits.hh:229
True if To and From are the same type.
Definition: typetraits.hh:227
static const T value
value this type was generated for
Definition: typetraits.hh:459
IsBaseOf()
Definition: typetraits.hh:296
T1 type
The selected type.
Definition: typetraits.hh:426
ConstantVolatileTraits< T >::UnqualifiedType Type
Definition: typetraits.hh:157
T UnqualifiedType
Definition: typetraits.hh:118
_Tp type
Definition: typetraits.hh:509
#define DUNE_DEPRECATED_MSG(text)
Mark some entity as deprecated.
Definition: deprecated.hh:169
True if T has a volatile specifier.
Definition: typetraits.hh:87
Select a type based on a condition.
Definition: typetraits.hh:418
Enable typedef if condition is met.
Definition: typetraits.hh:328
Checks wether a type is derived from another.
Definition: typetraits.hh:282
ReferenceTraits< T >::ReferredType ReferredType
Definition: typetraits.hh:75
T2 type
Definition: typetraits.hh:432
T1 Type
The selected type.
Definition: typetraits.hh:395
_Tp type
Definition: typetraits.hh:505
T2 Type
Definition: typetraits.hh:401
is_pointer
Definition: typetraits.hh:484
Definition: typetraits.hh:71
const volatile T ConstVolatileType
The const volatile type.
Definition: typetraits.hh:97
const T ConstType
The const type.
Definition: typetraits.hh:95
const volatile UnqualifiedType ConstVolatileType
Definition: typetraits.hh:108
Definition: typetraits.hh:475
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
True if The type is volatile.
Definition: typetraits.hh:140
Select a type based on a condition.
Definition: typetraits.hh:387
Checks wether two types are interoperable.
Definition: typetraits.hh:307
Definition: typetraits.hh:155
Return the type a pointer type points to.
Definition: typetraits.hh:517
General type traits class to check whether type is reference or pointer type.
Definition: typetraits.hh:43
RemoveConstHelper< T, IsVolatile< T >::value >::Type type
Definition: typetraits.hh:177
Determine whether a type is a lvalue reference type.
Definition: typetraits.hh:499
T UnqualifiedType
Definition: typetraits.hh:106
True if Base is a base class of Derived.
Definition: typetraits.hh:294
Enable typedef if two types are interoperable.
Definition: typetraits.hh:345
Remove a reference from a type.
Definition: typetraits.hh:191
Removes a const qualifier while preserving others.
Definition: typetraits.hh:175
T UnqualifiedType
The unqualified type.
Definition: typetraits.hh:93
True if either a conversion from T1 to T2 or vice versa exists.
Definition: typetraits.hh:314
T value_type
type of value
Definition: typetraits.hh:461
Determines wether a type is const or volatile and provides the unqualified types. ...
Definition: typetraits.hh:83
Generate a type for a given integral constant.
Definition: typetraits.hh:457
volatile ConstantVolatileTraits< T >::UnqualifiedType Type
Definition: typetraits.hh:163
Definition: typetraits.hh:504