29 #ifndef __ETL_TYPE_TRAITS__
30 #define __ETL_TYPE_TRAITS__
44 template <
typename T, const T VALUE>
47 static const T value = VALUE;
52 operator value_type()
const
80 template <
typename T>
struct add_pointer {
typedef typename remove_reference<T>::type* type; };
84 template <
typename T>
struct is_const : false_type {};
85 template <
typename T>
struct is_const<const T> : true_type {};
86 template <
typename T>
struct is_const<const volatile T> : true_type {};
91 template <
typename T>
struct remove_const<const T> {
typedef T type; };
95 template <
typename T>
struct add_const {
typedef const T type; };
96 template <
typename T>
struct add_const<const T> {
typedef const T type; };
101 template <
typename T>
struct is_volatile<volatile T> : true_type {};
102 template <
typename T>
struct is_volatile<const volatile T> : true_type {};
111 template <
typename T>
struct add_volatile {
typedef volatile T type; };
112 template <
typename T>
struct add_volatile<volatile T> {
typedef volatile T type; };
143 template <>
struct is_integral<unsigned long long> : true_type {};
152 #ifdef PLATFORM_LINUX
153 template <>
struct is_signed<wchar_t> : true_type {};
155 template <>
struct is_signed<signed char> : true_type {};
162 template <>
struct is_signed<long double> : true_type{};
172 #ifndef PLATFORM_LINUX
178 template <>
struct is_unsigned<unsigned long long> : true_type {};
195 template <
typename T1,
typename T2>
struct is_same :
public false_type {};
196 template <
typename T>
struct is_same<T, T> :
public true_type {};
200 template<
typename T>
struct is_void : false_type {};
201 template<>
struct is_void<void> : true_type {};
212 typename remove_cv<T>::type>::value> {};
220 template <
typename T>
struct is_array : false_type {};
221 template <
typename T>
struct is_array<T[]> : true_type {};
222 template <
typename T,
size_t N>
struct is_array<T[N]> : true_type {};
237 template <>
struct make_signed<char> {
typedef signed char type; };
238 template <>
struct make_signed<unsigned char> {
typedef signed char type; };
239 #ifdef COMPILER_MICROSOFT
240 template <>
struct make_signed<wchar_t> {
typedef short type; };
242 template <>
struct make_signed<unsigned short> {
typedef short type; };
243 template <>
struct make_signed<unsigned int> {
typedef int type; };
244 template <>
struct make_signed<unsigned long> {
typedef long type; };
245 template <>
struct make_signed<unsigned long long> {
typedef long long type; };
248 template <
typename T>
struct make_signed<const volatile T> :
add_const<typename add_volatile<typename make_signed<T>::type>::type> {};
254 template <>
struct make_unsigned<signed char> {
typedef unsigned char type; };
256 #ifdef COMPILER_MICROSOFT
257 template <>
struct make_unsigned<wchar_t> {
typedef unsigned short type; };
261 template <>
struct make_unsigned<long long> {
typedef unsigned long long type; };
264 template <
typename T>
struct make_unsigned<const volatile T> :
add_const<typename add_volatile<typename make_unsigned<T>::type>::type> {};
268 template <
bool B,
typename T =
void>
struct enable_if {};
269 template <
typename T>
struct enable_if<true, T> {
typedef T type; };
273 template <
bool B,
typename T,
typename F>
struct conditional {
typedef T type; };
274 template <
typename T,
typename F>
struct conditional<false, T, F> {
typedef F type; };
278 template <
typename T,
size_t N = 0>
281 template <
typename T>
284 template <
typename T,
size_t N>
287 template <
typename T,
size_t N>
290 template <
typename T,
size_t I,
size_t N>
297 template <
typename T,
size_t N>
struct remove_extent<T[N]> {
typedef T type;};
302 template <
typename T>
struct remove_all_extents<T[]> {
typedef typename remove_all_extents<T>::type type; };
303 template <
typename T,
size_t N>
struct remove_all_extents<T[N]> {
typedef typename remove_all_extents<T>::type type; };
314 #ifdef COMPILER_MICROSOFT
315 template <
typename T>
struct alignment_of :
integral_constant<size_t, size_t(__alignof(T))> {};
319 template <
typename T>
struct alignment_of : integral_constant<size_t, size_t(__alignof__(T))> {};
323 template <
typename T>
struct alignment_of : integral_constant<size_t, size_t(__alignof__(T))> {};
327 template <
typename T>
struct alignment_of : integral_constant<size_t, size_t(__ALIGNOF__(T))> {};
Definition: type_traits.h:216
Definition: type_traits.h:273
Definition: type_traits.h:84
Definition: type_traits.h:95
Definition: type_traits.h:130
Definition: type_traits.h:80
Definition: type_traits.h:268
Definition: type_traits.h:209
integral_constant< bool, false > false_type
Definition: type_traits.h:60
Definition: type_traits.h:169
Definition: type_traits.h:90
Definition: algorithm.h:43
Definition: type_traits.h:150
Definition: type_traits.h:236
Definition: type_traits.h:279
Definition: type_traits.h:70
Definition: type_traits.h:307
Definition: type_traits.h:200
Definition: type_traits.h:106
Definition: type_traits.h:195
Definition: type_traits.h:65
Definition: type_traits.h:226
Definition: type_traits.h:45
Definition: type_traits.h:220
Definition: type_traits.h:295
Definition: type_traits.h:205
Definition: type_traits.h:100
Definition: type_traits.h:252
Definition: type_traits.h:123
Definition: type_traits.h:116
Definition: type_traits.h:75
Definition: type_traits.h:111
Definition: type_traits.h:231
Definition: type_traits.h:301
Definition: type_traits.h:185