1 #ifndef RDESTL_TYPETRAITS_H 2 #define RDESTL_TYPETRAITS_H 7 template<
typename T>
struct is_integral
9 enum { value =
false };
12 template<
typename T>
struct is_floating_point
14 enum { value =
false };
17 #define RDE_INTEGRAL(TYPE) template<> struct is_integral<TYPE> { enum { value = true }; } 24 RDE_INTEGRAL(
wchar_t);
26 template<>
struct is_floating_point<float> {
enum { value =
true }; };
27 template<>
struct is_floating_point<double> {
enum { value =
true }; };
29 template<
typename T>
struct is_pointer
31 enum { value =
false };
33 template<
typename T>
struct is_pointer<T*>
35 enum { value =
true };
38 template<
typename T>
struct is_pod
40 enum { value =
false };
43 template<
typename T>
struct is_fundamental
47 value = is_integral<T>::value || is_floating_point<T>::value
51 template<
typename T>
struct has_trivial_constructor
55 value = is_fundamental<T>::value || is_pointer<T>::value || is_pod<T>::value
59 template<
typename T>
struct has_trivial_copy
63 value = is_fundamental<T>::value || is_pointer<T>::value || is_pod<T>::value
67 template<
typename T>
struct has_trivial_assign
71 value = is_fundamental<T>::value || is_pointer<T>::value || is_pod<T>::value
75 template<
typename T>
struct has_trivial_destructor
79 value = is_fundamental<T>::value || is_pointer<T>::value || is_pod<T>::value
83 template<
typename T>
struct has_cheap_compare
87 value = has_trivial_copy<T>::value &&
sizeof(T) <= 4
94 #endif // #ifndef RDESTL_TYPETRAITS_H