32#error THIS HEADER IS A GENERATOR. DO NOT INCLUDE.
53#ifndef ETL_TYPE_TRAITS_INCLUDED
54#define ETL_TYPE_TRAITS_INCLUDED
58#include "static_assert.h"
68#if ETL_USING_STL && ETL_USING_CPP11
69 #include <type_traits>
75 template <
typename...>
79#if ETL_NOT_USING_STL || ETL_CPP11_NOT_SUPPORTED
87 template <
typename T, T VALUE>
88 struct integral_constant
90 static const T value = VALUE;
93 typedef integral_constant<T, VALUE> type;
95 operator value_type()
const
102 typedef integral_constant<bool, false>
false_type;
103 typedef integral_constant<bool, true> true_type;
105 template <
typename T, T VALUE>
106 const T integral_constant<T, VALUE>::value;
109 template <
typename T, T VALUE>
115 using bool_constant = integral_constant<bool, B>;
123 inline constexpr bool bool_constant_v = bool_constant<B>::value;
128 template <
typename T>
134 template <
typename T>
135 inline constexpr bool negation_v = negation<T>::value;
140 template <
typename T>
struct remove_reference {
typedef T type; };
147 template <
typename T>
148 using remove_reference_t =
typename remove_reference<T>::type;
153 template <
typename T>
struct remove_pointer {
typedef T type; };
156 template <
typename T>
struct remove_pointer<volatile T*> {
typedef volatile T type; };
157 template <
typename T>
struct remove_pointer<const volatile T*> {
typedef const volatile T type; };
159 template <
typename T>
struct remove_pointer<const T*
const> {
typedef const T type; };
160 template <
typename T>
struct remove_pointer<volatile T*
const> {
typedef volatile T type; };
161 template <
typename T>
struct remove_pointer<const volatile T*
const> {
typedef const volatile T type; };
164 template <
typename T>
165 using remove_pointer_t =
typename remove_pointer<T>::type;
170 template <
typename T>
struct add_pointer {
typedef typename remove_reference<T>::type* type; };
173 template <
typename T>
174 using add_pointer_t =
typename add_pointer<T>::type;
179 template <
typename T>
struct is_const :
false_type {};
184 template <
typename T>
190 template <
typename T>
struct remove_const {
typedef T type; };
191 template <
typename T>
struct remove_const<const T> {
typedef T type; };
194 template <
typename T>
195 using remove_const_t =
typename remove_const<T>::type;
200 template <
typename T>
struct add_const {
typedef const T type; };
201 template <
typename T>
struct add_const<const T> {
typedef const T type; };
204 template <
typename T>
205 using add_const_t =
typename add_const<T>::type;
215 template <
typename T>
225 template <
typename T>
226 using remove_volatile_t =
typename remove_volatile<T>::type;
231 template <
typename T>
struct add_volatile {
typedef volatile T type; };
232 template <
typename T>
struct add_volatile<volatile T> {
typedef volatile T type; };
235 template <
typename T>
236 using add_volatile_t =
typename add_volatile<T>::type;
247 template <
typename T>
248 using remove_cv_t =
typename remove_cv<T>::type;
253 template <
typename T>
struct add_cv
255 typedef typename add_volatile<typename add_const<T>::type>::type type;
259 template <
typename T>
260 using add_cv_t =
typename add_cv<T>::type;
265 template <
typename T>
struct remove_cvref
267 typedef typename remove_cv<typename remove_reference<T>::type>::type type;
271 template <
typename T>
272 using remove_cvref_t =
typename remove_cvref<T>::type;
277 template <
typename T>
struct is_integral :
false_type {};
296 template <
typename T>
304 template <> struct is_signed<wchar_t> : public etl::bool_constant<static_cast<bool>(wchar_t(-1) < wchar_t(0))> {};
305 template <> struct is_signed<signed char> : true_type {};
306 template <> struct is_signed<short> : true_type {};
307 template <> struct is_signed<int> : true_type {};
308 template <> struct is_signed<long> : true_type {};
309 template <> struct is_signed<long long> : true_type {};
310 template <> struct is_signed<float> : true_type {};
311 template <> struct is_signed<double> : true_type {};
312 template <> struct is_signed<long double> : true_type {};
313 template <typename T> struct is_signed<const T> : is_signed<T> {};
314 template <typename T> struct is_signed<volatile T> : is_signed<T> {};
315 template <typename T> struct is_signed<const volatile T> : is_signed<T> {};
318 template <typename T>
319 inline constexpr bool is_signed_v = is_signed<T>::value;
324 template <typename T> struct is_unsigned : false_type {};
325 template <> struct is_unsigned<bool> : true_type {};
326 template <> struct is_unsigned<char> : etl::bool_constant<(char(255) > 0)> {};
327 template <> struct is_unsigned<unsigned char> : true_type {};
328 template <> struct is_unsigned<wchar_t> : public etl::bool_constant<(wchar_t(-1) > wchar_t(0))> {};
338 template <
typename T>
353 template <
typename T>
363 template <
typename T1,
typename T2>
373 template <
typename T>
382 template <
typename T>
383 inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
388 template <
typename T>
struct is_fundamental :
etl::bool_constant<is_arithmetic<T>::value || is_void<T>::value> {};
391 template <
typename T>
392 inline constexpr bool is_fundamental_v = is_fundamental<T>::value;
397 template <
typename T>
struct is_compound :
etl::bool_constant<!is_fundamental<T>::value> {};
400 template <
typename T>
401 inline constexpr bool is_compound_v = is_compound<T>::value;
406 template <
typename T>
struct is_array :
false_type {};
411 template <
typename T>
422 template <
typename T>
423 inline constexpr bool is_pointer_v = is_pointer<T>::value;
433 template <
typename T>
440 template<
typename T>
struct is_rvalue_reference_helper :
false_type {};
441 template<
typename T>
struct is_rvalue_reference_helper<T&&> : true_type {};
442 template<
typename T>
struct is_rvalue_reference : is_rvalue_reference_helper<typename remove_cv<T>::type> {};
445 template <
typename T>
446 inline constexpr bool is_rvalue_reference_v = etl::is_rvalue_reference<T>::value;
453 template<
typename T>
struct is_reference : integral_constant<bool,
454 is_lvalue_reference<T>::value
456 || is_rvalue_reference<T>::value
461 template <
typename T>
462 inline constexpr bool is_reference_v = is_reference<T>::value;
468 template <
typename T>
struct is_pod :
etl::bool_constant<etl::is_fundamental<T>::value || etl::is_pointer<T>::value> {};
471 template <
typename T>
477 template <
bool B,
typename T,
typename F>
struct conditional {
typedef T type; };
478 template <
typename T,
typename F>
struct conditional<false, T, F> {
typedef F type; };
481 template <
bool B,
typename T,
typename F>
482 using conditional_t =
typename conditional<B, T, F>::type;
487 template <
typename T>
struct make_signed {
typedef T type; };
488 template <>
struct make_signed<char> {
typedef signed char type; };
489 template <>
struct make_signed<unsigned char> {
typedef signed char type; };
497 void>::type>::type
type;
500 template <>
struct make_signed<unsigned short> {
typedef short type; };
501 template <>
struct make_signed<unsigned int> {
typedef int type; };
502 template <>
struct make_signed<unsigned long> {
typedef long type; };
503 template <>
struct make_signed<unsigned long long> {
typedef long long type; };
506 template <
typename T>
struct make_signed<const volatile T> :
add_const<typename add_volatile<typename make_signed<T>::type>::type> {};
509 template <
typename T>
510 using make_signed_t =
typename make_signed<T>::type;
515 template <
typename T>
struct make_unsigned {
typedef T type; };
517 template <>
struct make_unsigned<signed char> {
typedef unsigned char type; };
526 void>::type>::type
type;
531 template <>
struct make_unsigned<long long> {
typedef unsigned long long type; };
534 template <
typename T>
struct make_unsigned<const volatile T> :
add_const<typename add_volatile<typename make_unsigned<T>::type>::type> {};
537 template <
typename T>
538 using make_unsigned_t =
typename make_unsigned<T>::type;
543 template <
bool B,
typename T =
void>
struct enable_if {};
544 template <
typename T>
struct enable_if<true, T> {
typedef T type; };
547 template <
bool B,
typename T =
void>
553 template <
typename T,
unsigned MAXN = 0U>
556 template <
typename T>
559 template <
typename T,
unsigned MAXN>
562 template <
typename T,
unsigned MAXN>
565 template <
typename T,
unsigned I,
unsigned MAXN>
569 template <
typename T,
unsigned N = 0U>
575 template <
typename T>
struct remove_extent {
typedef T type; };
577 template <
typename T,
size_t MAXN>
struct remove_extent<T[MAXN]> {
typedef T type; };
580 template <
typename T>
581 using remove_extent_t =
typename remove_extent<T>::type;
587 template <
typename T>
struct remove_all_extents<T[]> {
typedef typename remove_all_extents<T>::type type; };
588 template <
typename T,
size_t MAXN>
struct remove_all_extents<T[MAXN]> {
typedef typename remove_all_extents<T>::type type; };
591 template <
typename T>
592 using remove_all_extents_t =
typename remove_all_extents<T>::type;
602 template <
typename T>
608 template <
typename T>
611 typedef typename etl::remove_reference<T>::type U;
613 typename etl::remove_extent<U>::type*,
614 typename etl::remove_cv<U>::type>::type type;
618 template <
typename T>
619 using decay_t =
typename decay<T>::type;
624 template<
typename TBase,
631 template<
typename T>
struct dummy {};
632 struct internal: TDerived, dummy<int>{};
634 static TBase* check(TBase*) {
return (TBase*)0; }
637 static char check(dummy<T>*) {
return 0; }
641 static const bool value = (
sizeof(check((internal*)0)) ==
sizeof(TBase*));
645 template<
typename TBase,
typename TDerived>
648 static const bool value =
false;
652 template <
typename T1,
typename T2>
658 namespace private_type_traits
660 template <
typename T>
char test(
int T::*);
663 template <
typename T>
dummy test(...);
666 template <
typename T>
670 template <
typename T>
671 inline constexpr bool is_class_v = is_class<T>::value;
676 template <
typename T>
struct add_lvalue_reference {
typedef T& type; };
684 template <
typename T>
685 using add_lvalue_reference_t =
typename etl::add_lvalue_reference<T>::type;
691 template <
typename T>
struct add_rvalue_reference {
using type = T && ; };
692 template <
typename T>
struct add_rvalue_reference<T&> {
using type = T & ; };
693 template <>
struct add_rvalue_reference<void> {
using type = void; };
694 template <>
struct add_rvalue_reference<const void> {
using type =
const void; };
695 template <>
struct add_rvalue_reference<volatile void> {
using type =
volatile void; };
696 template <>
struct add_rvalue_reference<const volatile void> {
using type =
const volatile void; };
700 template <
typename T>
701 using add_rvalue_reference_t =
typename etl::add_rvalue_reference<T>::type;
707 template <
typename T>
708 typename etl::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
717 namespace private_type_traits
720 template <
typename T,
typename =
int>
727 template <
typename T>
728 struct is_convertible_to_int<T, decltype(static_cast<int>(declval<T>()))>
734 template <
typename T>
736 : integral_constant<bool, private_type_traits::is_convertible_to_int<T>::value &&
737 !is_class<T>::value &&
738 !is_arithmetic<T>::value &&
739 !is_reference<T>::value>
744 template <
typename T>
745 inline constexpr bool is_enum_v = etl::is_enum<T>::value;
753 namespace private_type_traits
758 template <
typename T>
759 auto returnable(
int)->true_type_for<T()>;
762 auto returnable(...)->etl::false_type;
764 template <
typename TFrom,
typename TTo>
765 auto nonvoid_convertible(
int)->true_type_for<
decltype(etl::declval<void(&)(TTo)>()(etl::declval<TFrom>()))
767 template <
typename,
typename>
768 auto nonvoid_convertible(...)->etl::false_type;
771#if defined(ETL_COMPILER_ARM5)
772 template <
typename TFrom,
typename TTo>
775 template <
typename TFrom,
typename TTo>
776 struct is_convertible :
etl::bool_constant<(decltype(private_type_traits::returnable<TTo>(0))::value &&
777 decltype(private_type_traits::nonvoid_convertible<TFrom, TTo>(0))::value) ||
778 (etl::is_void<TFrom>::value && etl::is_void<TTo>::value)> {};
783 template <
typename TFrom,
typename TTo >
784 inline constexpr bool is_convertible_v = etl::is_convertible<TFrom, TTo>::value;
790#if ETL_USING_CPP11 && !defined(ETL_COMPILER_ARM5)
791 template <
typename T>
struct alignment_of : integral_constant<size_t, alignof(T)> { };
792#elif defined(ETL_COMPILER_MICROSOFT)
793 template <
typename T>
struct alignment_of : integral_constant<size_t, size_t(__alignof(T))> {};
794#elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI)
795 template <
typename T>
struct alignment_of : integral_constant<size_t, size_t(__ALIGNOF__(T))> {};
797 template <
typename T>
struct alignment_of : integral_constant<size_t, size_t(__alignof__(T))> {};
802 template <>
struct alignment_of<void> : integral_constant <size_t, 0> {};
803 template <>
struct alignment_of<const void> : integral_constant <size_t, 0> {};
806 template <
typename T>
819 template <
typename T, T VALUE>
820 struct integral_constant : std::integral_constant<T, VALUE> {};
824typedef integral_constant<bool, false>
false_type;
825typedef integral_constant<bool, true> true_type;
828 template <
typename T, T VALUE>
829 inline constexpr T integral_constant_v = std::integral_constant<T, VALUE>::value;
834 using bool_constant = std::bool_constant<B>;
837 struct bool_constant : std::integral_constant<bool, B> { };
842 inline constexpr bool bool_constant_v = bool_constant<B>::value;
849 template <
typename T>
850 using negation = std::negation<T>;
852 template <
typename T>
859 template <
typename T>
860 inline constexpr bool negation_v = std::negation_v<T>;
866 template <
typename T>
struct remove_reference : std::remove_reference<T> {};
869 template <
typename T>
870 using remove_reference_t =
typename std::remove_reference<T>::type;
876 template <
typename T>
struct remove_pointer : std::remove_pointer<T> {};
879 template <
typename T>
880 using remove_pointer_t =
typename std::remove_pointer<T>::type;
886 template <
typename T>
struct add_pointer : std::add_pointer<T> {};
889 template <
typename T>
890 using add_pointer_t =
typename std::add_pointer<T>::type;
896 template <
typename T>
struct is_const : std::is_const<T> {};
899 template <
typename T>
900 inline constexpr bool is_const_v = std::is_const_v<T>;
906 template <
typename T>
struct remove_const : std::remove_const<T> {};
909 template <
typename T>
910 using remove_const_t =
typename std::remove_const<T>::type;
916 template <
typename T>
struct add_const : std::add_const<T> {};
919 template <
typename T>
920 using add_const_t =
typename std::add_const<T>::type;
926 template <
typename T>
struct is_volatile : std::is_volatile<T> {};
929 template <
typename T>
930 inline constexpr bool is_volatile_v = std::is_volatile_v<T>;
936 template <
typename T>
struct remove_volatile : std::remove_volatile<T> {};
939 template <
typename T>
940 using remove_volatile_t =
typename std::remove_volatile<T>::type;
946 template <
typename T>
struct add_volatile : std::add_volatile<T> {};
949 template <
typename T>
950 using add_volatile_t =
typename std::add_volatile<T>::type;
956 template <
typename T>
struct remove_cv : std::remove_cv<T> {};
959 template <
typename T>
960 using remove_cv_t =
typename std::remove_cv<T>::type;
966 template <
typename T>
struct add_cv : std::add_cv<T> {};
969 template <
typename T>
970 using add_cv_t =
typename std::add_cv<T>::type;
976 template <
typename T>
struct remove_cvref
978 typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
982 template <
typename T>
983 using remove_cvref_t =
typename etl::remove_cvref<T>::type;
989 template <
typename T>
struct is_integral : std::is_integral<T> {};
992 template <
typename T>
993 inline constexpr bool is_integral_v = std::is_integral_v<T>;
999 template <
typename T>
struct is_signed : std::is_signed<T> {};
1002 template <
typename T>
1003 inline constexpr bool is_signed_v = std::is_signed_v<T>;
1009 template <
typename T>
struct is_unsigned : std::is_unsigned<T> {};
1012 template <
typename T>
1013 inline constexpr bool is_unsigned_v = std::is_unsigned_v<T>;
1019 template <
typename T>
struct is_floating_point : std::is_floating_point<T> {};
1022 template <
typename T>
1023 inline constexpr bool is_floating_point_v = std::is_floating_point_v<T>;
1029 template <
typename T1,
typename T2>
struct is_same : std::is_same<T1, T2> {};
1032 template <
typename T1,
typename T2>
1033 inline constexpr bool is_same_v = std::is_same_v<T1, T2>;
1039 template<
typename T>
struct is_void : std::is_void<T> {};
1042 template <
typename T>
1043 inline constexpr bool is_void_v = std::is_void_v<T>;
1049 template<
typename T>
struct is_arithmetic : std::is_arithmetic<T> {};
1052 template <
typename T>
1053 inline constexpr bool is_arithmetic_v = std::is_arithmetic_v<T>;
1059 template <
typename T>
struct is_fundamental : std::is_fundamental<T> {};
1062 template <
typename T>
1063 inline constexpr bool is_fundamental_v = std::is_fundamental_v<T>;
1069 template <
typename T>
struct is_compound : std::is_compound<T> {};
1072 template <
typename T>
1073 inline constexpr bool is_compound_v = std::is_compound_v<T>;
1079 template <
typename T>
struct is_array : std::is_array<T> {};
1082 template <
typename T>
1083 inline constexpr bool is_array_v = std::is_array_v<T>;
1089 template<
typename T>
struct is_pointer : std::is_pointer<T> {};
1092 template <
typename T>
1093 inline constexpr bool is_pointer_v = std::is_pointer_v<T>;
1099 template<
typename T>
struct is_reference : std::is_reference<T> {};
1102 template <
typename T>
1103 inline constexpr bool is_reference_v = std::is_reference_v<T>;
1109 template<
typename T>
struct is_lvalue_reference : std::is_lvalue_reference<T> {};
1112 template <
typename T>
1113 inline constexpr bool is_lvalue_reference_v = std::is_lvalue_reference_v<T>;
1120 template<
typename T>
struct is_rvalue_reference : std::is_rvalue_reference<T> {};
1123 template <
typename T>
1124 inline constexpr bool is_rvalue_reference_v = std::is_rvalue_reference_v<T>;
1131 template <
typename T>
1132 struct is_pod : std::integral_constant<bool, std::is_standard_layout<T>::value && std::is_trivial<T>::value> {};
1135 template <
typename T>
1136 inline constexpr bool is_pod_v = std::is_standard_layout_v<T> && std::is_trivial_v<T>;
1139#if defined(ETL_COMPILER_GCC)
1140 #if ETL_COMPILER_VERSION >= 5
1141 #define ETL_GCC_V5_TYPE_TRAITS_SUPPORTED
1148 template <
bool B,
typename T,
typename F>
struct conditional {
typedef T type; };
1149 template <
typename T,
typename F>
struct conditional<false, T, F> {
typedef F type; };
1152 template <
bool B,
typename T,
typename F>
1153 using conditional_t =
typename conditional<B, T, F>::type;
1159 template <
typename T>
struct make_signed : std::make_signed<T> {};
1162 template <
typename T>
1163 using make_signed_t =
typename std::make_signed<T>::type;
1169 template <
typename T>
struct make_unsigned : std::make_unsigned<T> {};
1172 template <
typename T>
1173 using make_unsigned_t =
typename std::make_unsigned<T>::type;
1179 template <
bool B,
typename T =
void>
struct enable_if : std::enable_if<B, T> {};
1182 template <
bool B,
typename T =
void>
1183 using enable_if_t =
typename std::enable_if<B, T>::type;
1189 template <
typename T,
unsigned MAXN = 0U>
1190 struct extent : std::extent<T, MAXN> {};
1193 template <
typename T,
unsigned MAXN = 0U>
1194 inline constexpr size_t extent_v = std::extent_v<T, MAXN>;
1200 template <
typename T>
struct remove_extent : std::remove_extent<T> { };
1203 template <
typename T>
1204 using remove_extent_t =
typename std::remove_extent<T>::type;
1210 template <
typename T>
struct remove_all_extents : std::remove_all_extents<T> { };
1213 template <
typename T>
1214 using remove_all_extents_t =
typename std::remove_all_extents<T>::type;
1220 template <
typename T>
struct rank : std::rank<T> {};
1223 template <
typename T>
1224 inline constexpr size_t rank_v = std::rank_v<T>;
1230 template <
typename T>
struct decay : std::decay<T> {};
1233 template <
typename T>
1234 using decay_t =
typename std::decay<T>::type;
1240 template<
typename TBase,
typename TDerived>
struct is_base_of : std::is_base_of<TBase, TDerived> {};
1243 template <
typename TBase,
typename TDerived>
1244 inline constexpr bool is_base_of_v = std::is_base_of_v<TBase, TDerived>;
1249 template <
typename T>
struct is_class : std::is_class<T>{};
1252 template <
typename T>
1253 inline constexpr bool is_class_v = is_class<T>::value;
1258 template <
typename T>
struct add_lvalue_reference : std::add_lvalue_reference<T> {};
1261 template <
typename T>
1262 using add_lvalue_reference_t =
typename std::add_lvalue_reference<T>::type;
1268 template <
typename T>
struct add_rvalue_reference : std::add_rvalue_reference<T> {};
1272 template <
typename T>
1273 using add_rvalue_reference_t =
typename std::add_rvalue_reference<T>::type;
1279 template <
typename T>
1280 typename std::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
1287 template <
typename T>
1288 struct is_enum : std::is_enum<T>
1293 template <
typename T>
1294 inline constexpr bool is_enum_v = etl::is_enum<T>::value;
1303 template <
typename TFrom,
typename TTo>
1304 struct is_convertible : std::is_convertible<TFrom, TTo> {};
1308 template <
typename TFrom,
typename TTo>
1309 inline constexpr bool is_convertible_v = std::is_convertible_v<TFrom, TTo>;
1315 template <
typename T>
struct alignment_of : std::alignment_of<T> {};
1316 template <>
struct alignment_of<void> : std::integral_constant<size_t, 0> {};
1317 template <>
struct alignment_of<const void> : std::integral_constant <size_t, 0> {};
1320 template <
typename T>
1321 inline constexpr size_t alignment_of_v = std::alignment_of_v<T>;
1333 template <
bool B,
typename T, T TRUE_VALUE, T FALSE_VALUE>
1334 struct conditional_integral_constant;
1336 template <
typename T, T TRUE_VALUE, T FALSE_VALUE>
1337 struct conditional_integral_constant<true, T, TRUE_VALUE, FALSE_VALUE>
1340 static const T value = TRUE_VALUE;
1343 template <
typename T, T TRUE_VALUE, T FALSE_VALUE>
1344 struct conditional_integral_constant<false, T, TRUE_VALUE, FALSE_VALUE>
1347 static const T value = FALSE_VALUE;
1354 template <
typename T,
typename T1,
typename... TRest>
1361 template <
typename T,
typename T1>
1362 struct is_one_of<T, T1>
1370 template <
typename T,
1371 typename T1,
typename T2 = void,
typename T3 = void,
typename T4 = void,
1372 typename T5 = void,
typename T6 = void,
typename T7 = void,
typename T8 = void,
1373 typename T9 = void,
typename T10 = void,
typename T11 = void,
typename T12 = void,
1374 typename T13 = void,
typename T14 = void,
typename T15 = void,
typename T16 =
void>
1377 static const bool value =
1398 template <
typename T,
typename... TRest>
1399 inline constexpr bool is_one_of_v =
etl::is_one_of<T, TRest...>::value;
1407 template <
typename T>
1416 typedef type_t type;
1417 typedef type_t& reference;
1418 typedef const type_t& const_reference;
1419 typedef type_t* pointer;
1420 typedef const type_t* const_pointer;
1421 typedef const type_t*
const const_pointer_const;
1424 typedef type_t&& rvalue_reference;
1429 template <
typename T>
1438 typedef type_t type;
1439 typedef type_t& reference;
1440 typedef const type_t& const_reference;
1441 typedef type_t* pointer;
1442 typedef const type_t* const_pointer;
1443 typedef const type_t*
const const_pointer_const;
1446 typedef type_t&& rvalue_reference;
1451 template <
typename T>
1452 struct types<T*
const>
1460 typedef type_t type;
1461 typedef type_t& reference;
1462 typedef const type_t& const_reference;
1463 typedef type_t* pointer;
1464 typedef const type_t* const_pointer;
1465 typedef const type_t*
const const_pointer_const;
1468 typedef type_t&& rvalue_reference;
1473 template <
typename T>
1482 typedef type_t type;
1483 typedef type_t& reference;
1484 typedef const type_t& const_reference;
1485 typedef type_t* pointer;
1486 typedef const type_t* const_pointer;
1487 typedef const type_t*
const const_pointer_const;
1490 typedef type_t&& rvalue_reference;
1496 template <
typename T>
1505 typedef type_t type;
1506 typedef type_t& reference;
1507 typedef const type_t& const_reference;
1508 typedef type_t* pointer;
1509 typedef const type_t* const_pointer;
1510 typedef const type_t*
const const_pointer_const;
1513 typedef type_t&& rvalue_reference;
1519 template <
typename T>
1520 using types_t =
typename types<T>::type;
1522 template <
typename T>
1523 using types_r =
typename types<T>::reference;
1525 template <
typename T>
1526 using types_cr =
typename types<T>::const_reference;
1528 template <
typename T>
1529 using types_rr =
typename types<T>::rvalue_reference;
1531 template <
typename T>
1532 using types_p =
typename types<T>::pointer;
1534 template <
typename T>
1535 using types_cp =
typename types<T>::const_pointer;
1537 template <
typename T>
1538 using types_cpc =
typename types<T>::const_pointer_const;
1548 template <
typename T>
1555 template <
typename T,
typename T1,
typename... TRest>
1559 etl::are_all_same<T, TRest...>::value;
1562 template <
typename T,
typename T1>
1563 struct are_all_same<T, T1>
1570 template <
typename T,
typename T1,
typename... TRest>
1571 inline constexpr bool are_all_same_v = are_all_same<T, T1, TRest...>::value;
1577 template <
typename...>
1582 template <
typename T1,
typename... Tn>
1583 struct conjunction<T1, Tn...> :
public etl::conditional_t<bool(T1::value), etl::conjunction<Tn...>, T1>
1587 template <
typename T>
1588 struct conjunction<T> :
public T
1594 template <
typename... T>
1595 inline constexpr bool conjunction_v = conjunction<T...>::value;
1601 template <
typename...>
1606 template <
typename T1,
typename... Tn>
1607 struct disjunction<T1, Tn...> :
public etl::conditional_t<bool(T1::value), T1, disjunction<Tn...>>
1611 template <
typename T1>
struct disjunction<T1> :
public T1
1617 template <
typename... T>
1618 inline constexpr bool disjunction_v = etl::disjunction<T...>::value;
1622#if ETL_USING_STL && ETL_USING_CPP11 && !defined(ETL_USE_TYPE_TRAITS_BUILTINS) && !defined(ETL_USER_DEFINED_TYPE_TRAITS) && ((!defined(ARDUINO) && ETL_NOT_USING_STLPORT) || defined(ETL_GCC_V5_TYPE_TRAITS_SUPPORTED))
1630 template<
typename T1,
typename T2>
1631 using is_assignable = std::is_assignable<T1, T2>;
1635 template<
typename T,
typename... TArgs>
1636 using is_constructible = std::is_constructible<T, TArgs...>;
1640 template <
typename T>
1641 using is_copy_constructible = std::is_copy_constructible<T>;
1645 template <
typename T>
1646 using is_move_constructible = std::is_move_constructible<T>;
1650#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1651 template <
typename T>
1652 using is_trivially_constructible = std::is_trivially_constructible<T>;
1654 template <
typename T>
1660#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1661 template <
typename T>
1662 using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
1664 template <
typename T>
1670#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1671 template <
typename T>
1672 using is_trivially_destructible = std::is_trivially_destructible<T>;
1674 template <
typename T>
1680#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1681 template <
typename T>
1682 using is_trivially_copy_assignable = std::is_trivially_copy_assignable<T>;
1684 template <
typename T>
1690#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
1691 template <
typename T>
1692 using is_trivially_copyable = std::is_trivially_copyable<T>;
1694 template <
typename T>
1698#elif defined(ETL_USE_TYPE_TRAITS_BUILTINS) && !defined(ETL_USER_DEFINED_TYPE_TRAITS)
1706 template<
typename T1,
typename T2>
1707 struct is_assignable
1709 static ETL_CONSTANT
bool value = __is_assignable(T1, T2);
1715 template<
typename T,
typename... TArgs>
1716 struct is_constructible
1718 static ETL_CONSTANT
bool value = __is_constructible(T, TArgs...);
1723 template<
typename T,
typename TArgs =
void>
1724 struct is_constructible
1726 static ETL_CONSTANT
bool value = __is_constructible(T, TArgs);
1731 template<
typename T>
1732 struct is_constructible<T, void>
1734 static ETL_CONSTANT
bool value = __is_constructible(T);
1740 template <
typename T>
1741 struct is_copy_constructible :
public etl::is_constructible<T, typename etl::add_lvalue_reference<const T>::type>
1747 template <
typename T>
1748 struct is_move_constructible :
public etl::is_constructible<T, T>
1755 template <
typename T,
typename... TArgs>
1756 struct is_trivially_constructible
1758#if defined(ETL_COMPILER_GCC)
1759 static ETL_CONSTANT
bool value = __has_trivial_constructor(T);
1761 static ETL_CONSTANT
bool value = __is_trivially_constructible(T, TArgs...);
1767 template <
typename T,
typename TArgs =
void>
1768 struct is_trivially_constructible
1770#if defined(ETL_COMPILER_GCC)
1771 static ETL_CONSTANT
bool value = __has_trivial_constructor(T);
1773 static ETL_CONSTANT
bool value = __is_trivially_constructible(T, TArgs);
1779 template <
typename T>
1780 struct is_trivially_constructible<T, void>
1782#if defined(ETL_COMPILER_GCC)
1783 static ETL_CONSTANT
bool value = __has_trivial_constructor(T);
1785 static ETL_CONSTANT
bool value = __is_trivially_constructible(T);
1792 template <
typename T>
1793 struct is_trivially_copy_constructible :
public is_trivially_constructible<T, typename add_lvalue_reference<const T>::type>
1799 template <
typename T>
1800 struct is_trivially_destructible
1802#if defined(ETL_COMPILER_GCC)
1803 static ETL_CONSTANT
bool value = __has_trivial_destructor(T);
1805 static ETL_CONSTANT
bool value = __is_trivially_destructible(T);
1811 template <
typename T>
1812 struct is_trivially_copy_assignable
1814#if defined(ETL_COMPILER_GCC)
1815 static ETL_CONSTANT
bool value = __has_trivial_copy(T);
1817 static ETL_CONSTANT
bool value = __is_trivially_copyable(T);
1823 template <
typename T>
1824 struct is_trivially_copyable
1826#if defined(ETL_COMPILER_GCC)
1827 static ETL_CONSTANT
bool value = __has_trivial_copy(T);
1829 static ETL_CONSTANT
bool value = __is_trivially_copyable(T);
1833#elif defined(ETL_USER_DEFINED_TYPE_TRAITS) && !defined(ETL_USE_TYPE_TRAITS_BUILTINS)
1842 template <
typename T1,
1845 struct is_assignable;
1847 template <
typename T1,
typename T2>
1852 template <
typename T1,
typename T2>
1853 struct is_assignable<T1, T2, false>;
1858 template <
typename T,
bool B,
typename... TArgs>
1859 struct is_constructible_helper;
1861 template <
typename T,
typename... TArgs>
1862 struct is_constructible_helper<T, true, TArgs...> :
public etl::true_type
1866 template <
typename T,
typename... TArgs>
1867 struct is_constructible_helper<T, false, TArgs...>;
1869 template <
typename T,
typename... TArgs>
1870 struct is_constructible :
public is_constructible_helper<T, etl::is_arithmetic<T>::value || etl::is_pointer<T>::value, TArgs...>
1878 struct is_copy_constructible;
1880 template <
typename T>
1885 template <
typename T>
1886 struct is_copy_constructible<T, false>;
1891 struct is_move_constructible;
1893 template <
typename T>
1898 template <
typename T>
1899 struct is_move_constructible<T, false>;
1904 struct is_trivially_constructible;
1906 template <
typename T>
1907 struct is_trivially_constructible<T, true> :
public etl::true_type
1911 template <
typename T>
1912 struct is_trivially_constructible<T, false>;
1917 struct is_trivially_copy_constructible;
1919 template <
typename T>
1920 struct is_trivially_copy_constructible<T, true> :
public etl::true_type
1924 template <
typename T>
1925 struct is_trivially_copy_constructible<T, false>;
1930 struct is_trivially_destructible;
1932 template <
typename T>
1933 struct is_trivially_destructible<T, true> :
public etl::true_type
1937 template <
typename T>
1938 struct is_trivially_destructible<T, false>;
1943 struct is_trivially_copy_assignable;
1945 template <
typename T>
1946 struct is_trivially_copy_assignable<T, true> :
public etl::true_type
1950 template <
typename T>
1951 struct is_trivially_copy_assignable<T, false>;
1956 struct is_trivially_copyable;
1958 template <
typename T>
1963 template <
typename T>
1964 struct is_trivially_copyable<T, false>;
1975 template <
typename T1,
typename T2>
1976 struct is_assignable :
public etl::bool_constant<(etl::is_arithmetic<T1>::value || etl::is_pointer<T1>::value) && (etl::is_arithmetic<T2>::value || etl::is_pointer<T2>::value)>
1983 namespace private_type_traits
1985 template <
class,
class T,
class... Args>
1988 template <
class T,
class... Args>
1989 struct is_constructible_<void_t<decltype(T(
etl::declval<Args>()...))>, T, Args...> :
etl::true_type {};
1994 template <
class T,
class... Args>
1995 using is_constructible = private_type_traits::is_constructible_<void_t<>, T, Args...>;
1999 template <
class T>
struct is_copy_constructible :
public is_constructible<T, typename etl::add_lvalue_reference<typename etl::add_const<T>::type>::type>{};
2000 template <>
struct is_copy_constructible<void> :
public false_type{};
2001 template <>
struct is_copy_constructible<void const> :
public false_type{};
2002 template <>
struct is_copy_constructible<void volatile> :
public false_type{};
2003 template <>
struct is_copy_constructible<void const volatile> :
public false_type{};
2007 template <
typename T>
struct is_move_constructible:
public is_constructible<T, typename etl::add_rvalue_reference<T>::type>{};
2008 template <>
struct is_move_constructible<void> :
public false_type{};
2009 template <>
struct is_move_constructible<void const> :
public false_type{};
2010 template <>
struct is_move_constructible<void volatile> :
public false_type{};
2011 template <>
struct is_move_constructible<void const volatile> :
public false_type{};
2017 template <
typename T>
2018 struct is_copy_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2024 template <
typename T>
2025 struct is_move_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2032 template <
typename T>
2033 struct is_trivially_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2039 template <
typename T>
2040 struct is_trivially_copy_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2046 template <
typename T>
2047 struct is_trivially_destructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2053 template <
typename T>
2054 struct is_trivially_copy_assignable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2060 template <
typename T>
2061 struct is_trivially_copyable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
2067 template <
typename T1,
typename T2>
2068 struct is_lvalue_assignable :
public etl::is_assignable<typename etl::add_lvalue_reference<T1>::type,
2069 typename etl::add_lvalue_reference<typename etl::add_const<T2>::type>::type>
2075 template <
typename T1,
typename T2>
2078 template <
typename T1,
typename T2>
2081 template<
typename T,
typename... TArgs>
2082 inline constexpr bool is_constructible_v = etl::is_constructible<T, TArgs...>::value;
2084 template<
typename T>
2087 template<
typename T>
2090 template <
typename T>
2093 template <
typename T>
2096 template <
typename T>
2099 template <
typename T>
2102 template <
typename T>
2115 template<
typename...>
2122 template <
typename T>
2123 struct common_type<T> : common_type<T, T>
2127 namespace private_common_type
2129 template <
typename T1,
typename T2>
2130 using conditional_result_t =
decltype(
false ? declval<T1>() : declval<T2>());
2132 template <
typename,
typename,
typename =
void>
2133 struct decay_conditional_result
2137 template <
typename T1,
typename T2>
2138 struct decay_conditional_result<T1, T2, void_t<conditional_result_t<T1, T2>>>
2143 template <
typename T1,
typename T2,
typename =
void>
2144 struct common_type_2_impl : decay_conditional_result<const T1&, const T2&>
2148 template <
typename T1,
typename T2>
2149 struct common_type_2_impl<T1, T2, void_t<conditional_result_t<T1, T2>>>
2150 : decay_conditional_result<T1, T2>
2157 template <
typename T1,
typename T2>
2158 struct common_type<T1, T2>
2159 :
etl::conditional<etl::is_same<T1, typename etl::decay<T1>::type>::value&& etl::is_same<T2, typename etl::decay<T2>::type>::value,
2160 private_common_type::common_type_2_impl<T1, T2>,
2161 common_type<typename etl::decay<T2>::type,
2162 typename etl::decay<T2>::type>>::type
2168 namespace private_common_type
2170 template <
typename AlwaysVoid,
typename T1,
typename T2,
typename... TRest>
2171 struct common_type_multi_impl
2175 template <
typename T1,
typename T2,
typename... TRest>
2176 struct common_type_multi_impl<void_t<typename common_type<T1, T2>::type>, T1, T2, TRest...>
2177 : common_type<typename common_type<T1, T2>::type, TRest...>
2182 template<
typename T1,
typename T2,
typename... TRest>
2183 struct common_type<T1, T2, TRest...>
2184 : private_common_type::common_type_multi_impl<void, T1, T2, TRest...>
2188 template <
typename... T>
2189 using common_type_t =
typename common_type<T...>::type;
2195 template <
typename T>
2196 struct unsigned_type
2198 typedef typename etl::conditional<
sizeof(T) ==
sizeof(
unsigned char),
unsigned char,
2199 typename etl::conditional<
sizeof(T) ==
sizeof(
unsigned short),
unsigned short,
2201 typename etl::conditional<
sizeof(T) ==
sizeof(
unsigned long),
unsigned long,
2202 unsigned long long>::type>::type>::type>::type type;
2206 template <
typename T>
2207 using unsigned_type_t =
typename unsigned_type<T>::type;
2213 template <
typename T>
2220 long long>::type>::type>::type>::type type;
2224 template <
typename T>
2225 using signed_type_t =
typename signed_type<T>::type;
2230#define ETL_IS_CHAR_TYPE(type) (etl::is_same<char, type>::value || etl::is_same<signed char, type>::value || etl::is_same<unsigned char, type>::value)
2231#define ETL_IS_NOT_CHAR_TYPE(type) (!ETL_IS_CHAR_TYPE(type))
2233#define ETL_IS_POINTER_TYPE(type) (etl::is_pointer<type>::value)
2234#define ETL_IS_NOT_POINTER_TYPE(type) (!ETL_IS_POINTER_TYPE(type))
2236#define ETL_TARGET_IS_TRIVIALLY_COPYABLE(type) (etl::is_trivially_copyable<typename etl::iterator_traits<type>::value_type>::value)
2237#define ETL_TARGET_IS_NOT_TRIVIALLY_COPYABLE(type) (!ETL_TARGET_IS_TRIVIALLY_COPYABLE(type))
Definition: constant.h:45
integral_constant< bool, false > false_type
integral_constant specialisations
Definition: type_traits_generator.h:836
add_const
Definition: type_traits_generator.h:928
add_pointer
Definition: type_traits_generator.h:898
add_volatile
Definition: type_traits_generator.h:958
add_rvalue_reference
Definition: type_traits_generator.h:1327
conditional
Definition: type_traits_generator.h:1160
decay
Definition: type_traits_generator.h:1242
enable_if
Definition: type_traits_generator.h:1191
extent
Definition: type_traits_generator.h:1202
integral_constant
Definition: type_traits_generator.h:832
is_arithmetic
Definition: type_traits_generator.h:1061
is_array
Definition: type_traits_generator.h:1091
is_base_of
Definition: type_traits_generator.h:1252
is_const
Definition: type_traits_generator.h:908
is_floating_point
Definition: type_traits_generator.h:1031
is_fundamental
Definition: type_traits_generator.h:1071
is_integral
Definition: type_traits_generator.h:1001
is_lvalue_reference
Definition: type_traits_generator.h:1121
is_rvalue_reference
Definition: type_traits_generator.h:1144
is_pointer
Definition: type_traits_generator.h:1101
is_same
Definition: type_traits_generator.h:1041
is_signed
Definition: type_traits_generator.h:1011
is_unsigned
Definition: type_traits_generator.h:1021
is_void
Definition: type_traits_generator.h:1051
is_volatile
Definition: type_traits_generator.h:938
make_signed
Definition: type_traits_generator.h:1171
make_unsigned
Definition: type_traits_generator.h:1181
rank
Definition: type_traits_generator.h:1232
remove_all_extents
Definition: type_traits_generator.h:1222
remove_const
Definition: type_traits_generator.h:918
remove_cv
Definition: type_traits_generator.h:968
remove_extent
Definition: type_traits_generator.h:1212
remove_pointer
Definition: type_traits_generator.h:888
remove_reference
Definition: type_traits_generator.h:878
remove_volatile
Definition: type_traits_generator.h:948
bitset_ext
Definition: absolute.h:38
Definition: type_traits.h:677
Definition: type_traits.h:679
Definition: type_traits.h:681
Definition: type_traits.h:678
Definition: type_traits.h:680
Definition: type_traits_generator.h:849
conjunction
Definition: type_traits_generator.h:1984
Definition: type_traits.h:647
is_class
Definition: type_traits_generator.h:1261
Definition: type_traits_generator.h:2026
Definition: type_traits_generator.h:2077
is_lvalue_reference
Definition: type_traits.h:428
Definition: type_traits_generator.h:2033
Definition: type_traits.h:1376
is_pointer
Definition: type_traits.h:417
Definition: type_traits_generator.h:2041
Definition: type_traits_generator.h:2062
Definition: type_traits_generator.h:2048
Definition: type_traits_generator.h:2069
Definition: type_traits_generator.h:2055
Definition: type_traits.h:662
size_of
Definition: type_traits_generator.h:1551
A set of templates to allow related types to be derived.
Definition: type_traits_generator.h:1416
void add_pointer(const volatile void *value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append)
Helper function for pointers.
Definition: to_string_helper.h:442