31#ifndef ETL_TYPE_TRAITS_INCLUDED
32#define ETL_TYPE_TRAITS_INCLUDED
36#include "static_assert.h"
46#if ETL_USING_STL && ETL_USING_CPP11
47 #include <type_traits>
53 template <
typename...>
57#if ETL_NOT_USING_STL || ETL_CPP11_NOT_SUPPORTED
65 template <
typename T, T VALUE>
68 static const T value = VALUE;
73 operator value_type()
const
83 template <
typename T, T VALUE>
84 const T integral_constant<T, VALUE>::value;
87 template <
typename T, T VALUE>
88 inline constexpr T integral_constant_v = etl::integral_constant<T, VALUE>::value;
92 template <
bool BValue>
95 template <
bool BValue>
102 template <
bool BValue>
103 inline constexpr bool bool_constant_v = bool_constant<BValue>::value;
108 template <
typename T>
114 template <
typename T>
115 inline constexpr bool negation_v = negation<T>::value;
120 template <
typename T>
125 template <
typename T>
131 template <
typename T>
139 template <
typename T>
140 using remove_reference_t =
typename remove_reference<T>::type;
145 template <
typename T>
150 template <
typename T>
155 template <
typename T>
158 typedef const T type;
160 template <
typename T>
163 typedef volatile T type;
165 template <
typename T>
168 typedef const volatile T type;
170 template <
typename T>
175 template <
typename T>
178 typedef const T type;
180 template <
typename T>
183 typedef volatile T type;
185 template <
typename T>
188 typedef const volatile T type;
192 template <
typename T>
193 using remove_pointer_t =
typename remove_pointer<T>::type;
198 template <
typename T>
201 typedef typename remove_reference<T>::type* type;
205 template <
typename T>
206 using add_pointer_t =
typename add_pointer<T>::type;
211 template <
typename T>
215 template <
typename T>
219 template <
typename T>
225 template <
typename T>
226 inline constexpr bool is_const_v = is_const<T>::value;
231 template <
typename T>
236 template <
typename T>
243 template <
typename T>
244 using remove_const_t =
typename remove_const<T>::type;
249 template <
typename T>
252 typedef const T type;
254 template <
typename T>
257 typedef const T type;
261 template <
typename T>
262 using add_const_t =
typename add_const<T>::type;
267 template <
typename T>
271 template <
typename T>
275 template <
typename T>
281 template <
typename T>
282 inline constexpr bool is_volatile_v = is_volatile<T>::value;
287 template <
typename T>
292 template <
typename T>
299 template <
typename T>
300 using remove_volatile_t =
typename remove_volatile<T>::type;
305 template <
typename T>
308 typedef volatile T type;
310 template <
typename T>
313 typedef volatile T type;
317 template <
typename T>
318 using add_volatile_t =
typename add_volatile<T>::type;
323 template <
typename T>
330 template <
typename T>
331 using remove_cv_t =
typename remove_cv<T>::type;
336 template <
typename T>
343 template <
typename T>
344 using add_cv_t =
typename add_cv<T>::type;
349 template <
typename T>
356 template <
typename T>
357 using remove_cvref_t =
typename remove_cvref<T>::type;
362 template <
typename T>
418 #if ETL_HAS_NATIVE_CHAR8_T
424 #if ETL_HAS_NATIVE_CHAR16_T
426 struct is_integral<char16_t> : true_type
430 #if ETL_HAS_NATIVE_CHAR32_T
436 template <
typename T>
440 template <
typename T>
444 template <
typename T>
450 template <
typename T>
451 inline constexpr bool is_integral_v = is_integral<T>::value;
456 template <
typename T>
465 struct is_signed<wchar_t> : public etl::bool_constant<wchar_t(-1) < wchar_t(0)>
469 struct is_signed<signed char> : true_type
473 struct is_signed<short> : true_type
477 struct is_signed<int> : true_type
481 struct is_signed<long> : true_type
485 struct is_signed<long long> : true_type
489 struct is_signed<float> : true_type
493 struct is_signed<double> : true_type
497 struct is_signed<long double> : true_type
500 #if ETL_HAS_NATIVE_CHAR8_T
502 struct is_signed<char8_t> : false_type
506 #if ETL_HAS_NATIVE_CHAR16_T
508 struct is_signed<char16_t> : false_type
512 #if ETL_HAS_NATIVE_CHAR32_T
514 struct is_signed<char32_t> : false_type
518 template <typename T>
519 struct is_signed<const T> : is_signed<T>
522 template <typename T>
523 struct is_signed<volatile T> : is_signed<T>
526 template <typename T>
527 struct is_signed<const volatile T> : is_signed<T>
532 template <typename T>
533 inline constexpr bool is_signed_v = is_signed<T>::value;
538 template <typename T>
539 struct is_unsigned : false_type
543 struct is_unsigned<bool> : true_type
547 struct is_unsigned<char> : etl::bool_constant<(char(255) > 0)>
551 struct is_unsigned<unsigned char> : true_type
555 struct is_unsigned<wchar_t> : public etl::bool_constant<(wchar_t(-1) > wchar_t(0))>{};
557 struct is_unsigned<unsigned short> : true_type
561 struct is_unsigned<unsigned int> : true_type
565 struct is_unsigned<unsigned long> : true_type
569 struct is_unsigned<unsigned long long> : true_type
572 #if ETL_HAS_NATIVE_CHAR8_T
574 struct is_unsigned<char8_t> : true_type
578 #if ETL_HAS_NATIVE_CHAR16_T
580 struct is_unsigned<char16_t> : true_type
584 #if ETL_HAS_NATIVE_CHAR32_T
586 struct is_unsigned<char32_t> : true_type
590 template <
typename T>
591 struct is_unsigned<const T> : is_unsigned<T>
594 template <
typename T>
595 struct is_unsigned<volatile T> : is_unsigned<T>
598 template <
typename T>
599 struct is_unsigned<const volatile T> : is_unsigned<T>
604 template <
typename T>
605 inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
610 template <
typename T>
615 struct is_floating_point<float> : true_type
619 struct is_floating_point<double> : true_type
623 struct is_floating_point<long double> : true_type
626 template <
typename T>
627 struct is_floating_point<const T> : is_floating_point<T>
630 template <
typename T>
631 struct is_floating_point<volatile T> : is_floating_point<T>
634 template <
typename T>
635 struct is_floating_point<const volatile T> : is_floating_point<T>
640 template <
typename T>
641 inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
646 template <
typename T1,
typename T2>
650 template <
typename T>
651 struct is_same<T, T> :
public true_type
656 template <
typename T1,
typename T2>
657 inline constexpr bool is_same_v = is_same<T1, T2>::value;
662 template <
typename T>
667 struct is_void<void> : true_type
671 struct is_void<const void> : true_type
675 struct is_void<volatile void> : true_type
679 struct is_void<const volatile void> : true_type
684 template <
typename T>
685 inline constexpr bool is_void_v = is_void<T>::value;
690 template <
typename T>
691 struct is_arithmetic : etl::bool_constant<is_integral<T>::value || is_floating_point<T>::value>
696 template <
typename T>
697 inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
702 template <
typename T>
703 struct is_fundamental : etl::bool_constant<is_arithmetic<T>::value || is_void<T>::value>
708 template <
typename T>
709 inline constexpr bool is_fundamental_v = is_fundamental<T>::value;
714 template <
typename T>
715 struct is_compound : etl::bool_constant<!is_fundamental<T>::value>
720 template <
typename T>
721 inline constexpr bool is_compound_v = is_compound<T>::value;
726 template <
typename T>
730 template <
typename T>
731 struct is_array<T[]> : true_type
734 template <
typename T,
size_t Size>
735 struct is_array<T[Size]> : true_type
740 template <
typename T>
741 inline constexpr bool is_array_v = is_array<T>::value;
746 template <
typename T>
750 template <
typename T>
751 struct is_pointer_helper<T*> : true_type
754 template <
typename T>
755 struct is_pointer_helper<const T*> : is_pointer_helper<T*>
758 template <
typename T>
759 struct is_pointer_helper<volatile T*> : is_pointer_helper<T*>
762 template <
typename T>
763 struct is_pointer_helper<const volatile T*> : is_pointer_helper<T*>
766 template <
typename T>
767 struct is_pointer : is_pointer_helper<typename remove_cv<T>::type>
772 template <
typename T>
773 inline constexpr bool is_pointer_v = is_pointer<T>::value;
778 template <
typename T>
779 struct is_lvalue_reference_helper :
false_type
782 template <
typename T>
783 struct is_lvalue_reference_helper<T&> : true_type
786 template <
typename T>
787 struct is_lvalue_reference : is_lvalue_reference_helper<typename remove_cv<T>::type>
792 template <
typename T>
793 inline constexpr bool is_lvalue_reference_v = etl::is_lvalue_reference<T>::value;
799 template <
typename T>
800 struct is_rvalue_reference_helper :
false_type
803 template <
typename T>
804 struct is_rvalue_reference_helper<T&&> : true_type
807 template <
typename T>
808 struct is_rvalue_reference : is_rvalue_reference_helper<typename remove_cv<T>::type>
813 template <
typename T>
814 inline constexpr bool is_rvalue_reference_v = etl::is_rvalue_reference<T>::value;
821 template <
typename T>
825 || is_rvalue_reference<T>::value
832 template <
typename T>
833 inline constexpr bool is_reference_v = is_reference<T>::value;
839 template <
typename T>
840 struct is_pod : etl::bool_constant<etl::is_fundamental<T>::value || etl::is_pointer<T>::value>
845 template <
typename T>
846 inline constexpr bool is_pod_v = etl::is_pod<T>::value;
851 template <
bool BValue,
typename T,
typename F>
856 template <
typename T,
typename F>
857 struct conditional<false, T, F>
863 template <
bool BValue,
typename T,
typename F>
864 using conditional_t =
typename conditional<BValue, T, F>::type;
869 template <
typename T>
875 struct make_signed<char>
877 typedef signed char type;
880 struct make_signed<unsigned char>
882 typedef signed char type;
886 struct make_signed<wchar_t>
888 typedef etl::conditional<
sizeof(wchar_t) ==
sizeof(int16_t), int16_t,
889 etl::conditional<
sizeof(wchar_t) ==
sizeof(int32_t), int32_t,
void>::type>::type type;
893 struct make_signed<unsigned short>
898 struct make_signed<unsigned int>
903 struct make_signed<unsigned long>
908 struct make_signed<unsigned long long>
910 typedef long long type;
912 template <
typename T>
913 struct make_signed<const T> :
add_const<typename make_signed<T>::type>
916 template <
typename T>
917 struct make_signed<volatile T> :
add_volatile<typename make_signed<T>::type>
920 template <
typename T>
921 struct make_signed<const volatile T> :
add_const<typename add_volatile<typename make_signed<T>::type>::type>
926 template <
typename T>
927 using make_signed_t =
typename make_signed<T>::type;
932 template <
typename T>
938 struct make_unsigned<char>
940 typedef unsigned char type;
943 struct make_unsigned<signed char>
945 typedef unsigned char type;
948 struct make_unsigned<short>
950 typedef unsigned short type;
954 struct make_unsigned<wchar_t>
956 typedef etl::conditional<
sizeof(wchar_t) ==
sizeof(uint16_t), uint16_t,
957 etl::conditional<
sizeof(wchar_t) ==
sizeof(uint32_t), uint32_t,
void>::type>::type type;
961 struct make_unsigned<int>
963 typedef unsigned int type;
966 struct make_unsigned<long>
968 typedef unsigned long type;
971 struct make_unsigned<long long>
973 typedef unsigned long long type;
975 template <
typename T>
976 struct make_unsigned<const T> :
add_const<typename make_unsigned<T>::type>
979 template <
typename T>
980 struct make_unsigned<volatile T> :
add_volatile<typename make_unsigned<T>::type>
983 template <
typename T>
984 struct make_unsigned<const volatile T> :
add_const<typename add_volatile<typename make_unsigned<T>::type>::type>
989 template <
typename T>
990 using make_unsigned_t =
typename make_unsigned<T>::type;
995 template <
bool BValue,
typename T =
void>
999 template <
typename T>
1000 struct enable_if<true, T>
1006 template <
bool BValue,
typename T =
void>
1007 using enable_if_t =
typename enable_if<BValue, T>::type;
1012 template <
typename T,
unsigned Size = 0U>
1017 template <
typename T>
1022 template <
typename T,
unsigned Size>
1023 struct extent<T[], Size> :
integral_constant<size_t, extent<T, Size - 1>::value>
1027 template <
typename T,
unsigned Size>
1032 template <
typename T,
unsigned I,
unsigned Size>
1033 struct extent<T[I], Size> :
integral_constant<size_t, extent<T, Size - 1>::value>
1038 template <
typename T,
unsigned Size = 0U>
1039 inline constexpr size_t extent_v = extent<T, Size>::value;
1044 template <
typename T>
1045 struct remove_extent
1049 template <
typename T>
1050 struct remove_extent<T[]>
1054 template <
typename T,
size_t Size>
1055 struct remove_extent<T[Size]>
1061 template <
typename T>
1062 using remove_extent_t =
typename remove_extent<T>::type;
1067 template <
typename T>
1068 struct remove_all_extents
1072 template <
typename T>
1073 struct remove_all_extents<T[]>
1075 typedef typename remove_all_extents<T>::type type;
1077 template <
typename T,
size_t Size>
1078 struct remove_all_extents<T[Size]>
1080 typedef typename remove_all_extents<T>::type type;
1084 template <
typename T>
1085 using remove_all_extents_t =
typename remove_all_extents<T>::type;
1090 template <
typename T>
1094 template <
typename T>
1098 template <
typename T,
size_t Size>
1104 template <
typename T>
1105 inline constexpr size_t rank_v = rank<T>::value;
1110 template <
typename T>
1113 typedef typename etl::remove_reference<T>::type U;
1114 typedef typename etl::conditional<etl::is_array<U>::value,
typename etl::remove_extent<U>::type*,
typename etl::remove_cv<U>::type>::type type;
1118 template <
typename T>
1119 using decay_t =
typename decay<T>::type;
1124 namespace private_type_traits
1126 template <
typename T>
1127 char test(
int T::*);
1133 template <
typename T>
1137 template <
typename T>
1138 struct is_class : etl::bool_constant<sizeof(private_type_traits::test<T>(0)) == 1U>
1143 template <
typename T>
1144 inline constexpr bool is_class_v = is_class<T>::value;
1150 namespace private_type_traits
1152 template <
typename B>
1153 etl::true_type test_ptr_conv(
const volatile B*);
1157 template <
typename B,
typename D>
1158 auto test_is_base_of(
int) ->
decltype(test_ptr_conv<B>(
static_cast<D*
>(
nullptr)));
1159 template <
typename,
typename>
1160 auto test_is_base_of(...) -> etl::true_type;
1163 template <
typename TBase,
typename TDerived>
1165 : etl::integral_constant< bool, etl::is_class<TBase>::value
1166 && etl::is_class<TDerived>::value&& decltype(private_type_traits::test_is_base_of< TBase, TDerived>(0))::value >
1170 template <
typename TBase,
typename TDerived,
1171 const bool IsFundamental = (etl::is_fundamental<TBase>::value || etl::is_fundamental<TDerived>::value || etl::is_array<TDerived>::value)>
1176 static TBase* check(TBase*)
1180 static char check(...)
1187 static const bool value = (
sizeof(check((TDerived*)0)) ==
sizeof(TBase*));
1191 template <
typename TBase,
typename TDerived>
1192 struct is_base_of<TBase, TDerived, true>
1194 static const bool value =
false;
1199 template <
typename T1,
typename T2>
1200 inline constexpr bool is_base_of_v = is_base_of<T1, T2>::value;
1206 #if ETL_USING_CPP11 && ETL_USING_BUILTIN_IS_VIRTUAL_BASE_OF
1207 template <
typename TBase,
typename TDerived>
1208 struct is_virtual_base_of : etl::bool_constant<__is_virtual_base_of(TBase, TDerived)>
1213 template <
typename TBase,
typename TDerived>
1214 inline constexpr bool is_virtual_base_of_v = is_virtual_base_of<TBase, TDerived>::value;
1220 template <
typename T>
1221 struct add_lvalue_reference
1225 template <
typename T>
1226 struct add_lvalue_reference<T&>
1231 struct add_lvalue_reference<void>
1236 struct add_lvalue_reference<const void>
1238 typedef const void type;
1241 struct add_lvalue_reference<volatile void>
1243 typedef volatile void type;
1246 struct add_lvalue_reference<const volatile void>
1248 typedef const volatile void type;
1252 template <
typename T>
1253 using add_lvalue_reference_t =
typename etl::add_lvalue_reference<T>::type;
1259 template <
typename T>
1260 struct add_rvalue_reference
1264 template <
typename T>
1265 struct add_rvalue_reference<T&>
1270 struct add_rvalue_reference<void>
1275 struct add_rvalue_reference<const void>
1277 using type =
const void;
1280 struct add_rvalue_reference<volatile void>
1282 using type =
volatile void;
1285 struct add_rvalue_reference<const volatile void>
1287 using type =
const volatile void;
1292 template <
typename T>
1293 using add_rvalue_reference_t =
typename etl::add_rvalue_reference<T>::type;
1299 template <
typename T>
1300 typename etl::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
1310 namespace private_type_traits
1313 template <
typename T,
typename =
int>
1321 template <
typename T>
1322 struct is_convertible_to_int<T, decltype(static_cast<int>(declval<T>()))> : true_type
1327 template <
typename T>
1329 :
integral_constant<bool, private_type_traits::is_convertible_to_int<T>::value && !is_class<T>::value && !is_arithmetic<T>::value
1330 && !is_reference<T>::value>
1335 template <
typename T>
1336 inline constexpr bool is_enum_v = etl::is_enum<T>::value;
1339 namespace private_type_traits
1342 template <
typename T>
1343 struct is_convertible_to_int
1345 static char test(
int);
1346 static double test(...);
1348 static const bool value =
sizeof(test(
static_cast<T
>(0))) ==
sizeof(
char);
1353 template <
typename T>
1356 static const bool value =
1357 private_type_traits::is_convertible_to_int<T>::value && !is_class<T>::value && !is_arithmetic<T>::value && !is_reference<T>::value;
1365 namespace private_type_traits
1368 using true_type_for = etl::true_type;
1370 template <
typename T>
1371 auto returnable(
int) -> true_type_for<T()>;
1376 template <
typename TFrom,
typename TTo>
1377 auto nonvoid_convertible(
int) -> true_type_for< decltype(etl::declval<void (&)(TTo)>()(etl::declval<TFrom>())) >;
1378 template <
typename,
typename>
1382 #if defined(ETL_COMPILER_ARM5)
1383 template <
typename TFrom,
typename TTo>
1384 struct is_convertible : etl::bool_constant<__is_convertible_to(TFrom, TTo)>
1388 template <
typename TFrom,
typename TTo>
1389 struct is_convertible
1390 : etl::bool_constant< (decltype(private_type_traits::returnable<TTo>(0))::value
1391 && decltype(private_type_traits::nonvoid_convertible<TFrom, TTo>(0))::value)
1392 || (etl::is_void<TFrom>::value && etl::is_void<TTo>::value)>
1398 template <
typename TFrom,
typename TTo>
1399 struct is_nothrow_convertible
1404 static void sink(TTo)
noexcept;
1407 template <
typename F>
1408 static auto test(
int) -> etl::bool_constant<noexcept(sink(etl::declval<F>()))>;
1416 static ETL_CONSTANT
bool value =
decltype(test<TFrom>(0))::value;
1419 namespace private_type_traits
1427 template <
typename TFrom,
typename TTo>
1428 struct is_convertible_impl
1430 static yes test(TTo);
1431 static no test(...);
1432 static TFrom make();
1433 static const bool value = (
sizeof(test(make())) ==
sizeof(yes));
1436 template <
typename TTo>
1437 struct is_convertible_impl<void, TTo>
1439 static const bool value =
false;
1442 template <
typename TFrom>
1443 struct is_convertible_impl<TFrom, void>
1445 static const bool value =
false;
1449 struct is_convertible_impl<void, void>
1451 static const bool value =
true;
1455 template <
typename TFrom,
typename TTo>
1456 struct is_convertible : etl::bool_constant< private_type_traits::is_convertible_impl<TFrom, TTo>::value>
1462 template <
typename TFrom,
typename TTo >
1463 inline constexpr bool is_convertible_v = etl::is_convertible<TFrom, TTo>::value;
1465 template <
typename TFrom,
typename TTo >
1466 inline constexpr bool is_nothrow_convertible_v = etl::is_nothrow_convertible<TFrom, TTo>::value;
1472 #if ETL_USING_CPP11 && !defined(ETL_COMPILER_ARM5)
1473 template <
typename T>
1477 #elif defined(ETL_COMPILER_MICROSOFT)
1478 template <
typename T>
1482 #elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI)
1483 template <
typename T>
1488 template <
typename T>
1506 template <
typename T>
1507 inline constexpr size_t alignment_of_v = etl::alignment_of<T>::value;
1519 template <
typename T, T VALUE>
1530 template <
typename T, T VALUE>
1531 inline constexpr T integral_constant_v = std::integral_constant<T, VALUE>::value;
1535 template <
bool BValue>
1538 template <
bool BValue>
1545 template <
bool BValue>
1546 inline constexpr bool bool_constant_v = bool_constant<BValue>::value;
1553 template <
typename T>
1556 template <
typename T>
1557 struct negation : etl::bool_constant<!bool(T::value)>
1563 template <
typename T>
1564 inline constexpr bool negation_v = std::negation_v<T>;
1570 template <
typename T>
1576 template <
typename T>
1577 using remove_reference_t =
typename std::remove_reference<T>::type;
1583 template <
typename T>
1589 template <
typename T>
1590 using remove_pointer_t =
typename std::remove_pointer<T>::type;
1596 template <
typename T>
1602 template <
typename T>
1603 using add_pointer_t =
typename std::add_pointer<T>::type;
1609 template <
typename T>
1615 template <
typename T>
1616 inline constexpr bool is_const_v = std::is_const_v<T>;
1622 template <
typename T>
1628 template <
typename T>
1629 using remove_const_t =
typename std::remove_const<T>::type;
1635 template <
typename T>
1641 template <
typename T>
1642 using add_const_t =
typename std::add_const<T>::type;
1648 template <
typename T>
1654 template <
typename T>
1655 inline constexpr bool is_volatile_v = std::is_volatile_v<T>;
1661 template <
typename T>
1667 template <
typename T>
1668 using remove_volatile_t =
typename std::remove_volatile<T>::type;
1674 template <
typename T>
1680 template <
typename T>
1681 using add_volatile_t =
typename std::add_volatile<T>::type;
1687 template <
typename T>
1693 template <
typename T>
1694 using remove_cv_t =
typename std::remove_cv<T>::type;
1700 template <
typename T>
1701 struct add_cv : std::add_cv<T>
1706 template <
typename T>
1707 using add_cv_t =
typename std::add_cv<T>::type;
1713 template <
typename T>
1716 typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
1720 template <
typename T>
1721 using remove_cvref_t =
typename etl::remove_cvref<T>::type;
1727 template <
typename T>
1733 template <
typename T>
1734 inline constexpr bool is_integral_v = std::is_integral_v<T>;
1740 template <
typename T>
1746 template <
typename T>
1747 inline constexpr bool is_signed_v = std::is_signed_v<T>;
1753 template <
typename T>
1754 struct is_unsigned : std::is_unsigned<T>
1759 template <
typename T>
1760 inline constexpr bool is_unsigned_v = std::is_unsigned_v<T>;
1766 template <
typename T>
1767 struct is_floating_point : std::is_floating_point<T>
1772 template <
typename T>
1773 inline constexpr bool is_floating_point_v = std::is_floating_point_v<T>;
1779 template <
typename T1,
typename T2>
1780 struct is_same : std::is_same<T1, T2>
1785 template <
typename T1,
typename T2>
1786 inline constexpr bool is_same_v = std::is_same_v<T1, T2>;
1792 template <
typename T>
1793 struct is_void : std::is_void<T>
1798 template <
typename T>
1799 inline constexpr bool is_void_v = std::is_void_v<T>;
1805 template <
typename T>
1806 struct is_arithmetic : std::is_arithmetic<T>
1811 template <
typename T>
1812 inline constexpr bool is_arithmetic_v = std::is_arithmetic_v<T>;
1818 template <
typename T>
1819 struct is_fundamental : std::is_fundamental<T>
1824 template <
typename T>
1825 inline constexpr bool is_fundamental_v = std::is_fundamental_v<T>;
1831 template <
typename T>
1832 struct is_compound : std::is_compound<T>
1837 template <
typename T>
1838 inline constexpr bool is_compound_v = std::is_compound_v<T>;
1844 template <
typename T>
1845 struct is_array : std::is_array<T>
1850 template <
typename T>
1851 inline constexpr bool is_array_v = std::is_array_v<T>;
1857 template <
typename T>
1858 struct is_pointer : std::is_pointer<T>
1863 template <
typename T>
1864 inline constexpr bool is_pointer_v = std::is_pointer_v<T>;
1870 template <
typename T>
1871 struct is_reference : std::is_reference<T>
1876 template <
typename T>
1877 inline constexpr bool is_reference_v = std::is_reference_v<T>;
1883 template <
typename T>
1884 struct is_lvalue_reference : std::is_lvalue_reference<T>
1889 template <
typename T>
1890 inline constexpr bool is_lvalue_reference_v = std::is_lvalue_reference_v<T>;
1897 template <
typename T>
1898 struct is_rvalue_reference : std::is_rvalue_reference<T>
1903 template <
typename T>
1904 inline constexpr bool is_rvalue_reference_v = std::is_rvalue_reference_v<T>;
1911 template <
typename T>
1913 : std::integral_constant< bool, std::is_standard_layout<T>::value && std::is_trivially_default_constructible<T>::value
1914 && std::is_trivially_copyable<T>::value>
1919 template <
typename T>
1920 inline constexpr bool is_pod_v = std::is_standard_layout_v<T> && std::is_trivially_default_constructible_v<T> && std::is_trivially_copyable_v<T>;
1923 #if defined(ETL_COMPILER_GCC)
1924 #if ETL_COMPILER_VERSION >= 5
1925 #define ETL_GCC_V5_TYPE_TRAITS_SUPPORTED
1932 template <
bool BValue,
typename T,
typename F>
1937 template <
typename T,
typename F>
1938 struct conditional<false, T, F>
1944 template <
bool BValue,
typename T,
typename F>
1945 using conditional_t =
typename conditional<BValue, T, F>::type;
1951 template <
typename T>
1952 struct make_signed : std::make_signed<T>
1957 template <
typename T>
1958 using make_signed_t =
typename std::make_signed<T>::type;
1964 template <
typename T>
1965 struct make_unsigned : std::make_unsigned<T>
1970 template <
typename T>
1971 using make_unsigned_t =
typename std::make_unsigned<T>::type;
1977 template <
bool BValue,
typename T =
void>
1978 struct enable_if : std::enable_if<BValue, T>
1983 template <
bool BValue,
typename T =
void>
1984 using enable_if_t =
typename std::enable_if<BValue, T>::type;
1990 template <
typename T,
unsigned Size = 0U>
1991 struct extent : std::extent<T, Size>
1996 template <
typename T,
unsigned Size = 0U>
1997 inline constexpr size_t extent_v = std::extent_v<T, Size>;
2003 template <
typename T>
2004 struct remove_extent : std::remove_extent<T>
2009 template <
typename T>
2010 using remove_extent_t =
typename std::remove_extent<T>::type;
2016 template <
typename T>
2017 struct remove_all_extents : std::remove_all_extents<T>
2022 template <
typename T>
2023 using remove_all_extents_t =
typename std::remove_all_extents<T>::type;
2029 template <
typename T>
2030 struct rank : std::rank<T>
2035 template <
typename T>
2036 inline constexpr size_t rank_v = std::rank_v<T>;
2042 template <
typename T>
2043 struct decay : std::decay<T>
2048 template <
typename T>
2049 using decay_t =
typename std::decay<T>::type;
2055 template <
typename TBase,
typename TDerived>
2056 struct is_base_of : std::is_base_of<TBase, TDerived>
2061 template <
typename TBase,
typename TDerived>
2062 inline constexpr bool is_base_of_v = std::is_base_of_v<TBase, TDerived>;
2069 #if ETL_HAS_STD_IS_VIRTUAL_BASE_OF
2070 template <
typename TBase,
typename TDerived>
2071 struct is_virtual_base_of : std::is_virtual_base_of<TBase, TDerived>
2076 template <
typename TBase,
typename TDerived>
2077 inline constexpr bool is_virtual_base_of_v = std::is_virtual_base_of_v<TBase, TDerived>;
2079 #elif ETL_USING_BUILTIN_IS_VIRTUAL_BASE_OF
2080 template <
typename TBase,
typename TDerived>
2081 struct is_virtual_base_of : etl::bool_constant<__is_virtual_base_of(TBase, TDerived)>
2086 template <
typename TBase,
typename TDerived>
2087 inline constexpr bool is_virtual_base_of_v = is_virtual_base_of<TBase, TDerived>::value;
2093 template <
typename T>
2094 struct is_class : std::is_class<T>
2099 template <
typename T>
2100 inline constexpr bool is_class_v = is_class<T>::value;
2105 template <
typename T>
2106 struct add_lvalue_reference : std::add_lvalue_reference<T>
2111 template <
typename T>
2112 using add_lvalue_reference_t =
typename std::add_lvalue_reference<T>::type;
2118 template <
typename T>
2119 struct add_rvalue_reference : std::add_rvalue_reference<T>
2125 template <
typename T>
2126 using add_rvalue_reference_t =
typename std::add_rvalue_reference<T>::type;
2132 template <
typename T>
2133 typename std::add_rvalue_reference<T>::type declval() ETL_NOEXCEPT;
2140 template <
typename T>
2141 struct is_enum : std::is_enum<T>
2146 template <
typename T>
2147 inline constexpr bool is_enum_v = etl::is_enum<T>::value;
2156 template <
typename TFrom,
typename TTo>
2157 struct is_convertible : std::is_convertible<TFrom, TTo>
2162 template <
typename TFrom,
typename TTo>
2163 struct is_nothrow_convertible
2168 static void sink(TTo)
noexcept;
2171 template <
typename F>
2172 static auto test(
int) -> etl::bool_constant<noexcept(sink(etl::declval<F>()))>;
2180 static ETL_CONSTANT
bool value =
decltype(test<TFrom>(0))::value;
2183 namespace private_type_traits
2191 template <
typename TFrom,
typename TTo>
2192 struct is_convertible_impl
2194 static yes test(TTo);
2195 static no test(...);
2196 static TFrom make();
2197 static const bool value = (
sizeof(test(make())) ==
sizeof(yes));
2200 template <
typename TTo>
2201 struct is_convertible_impl<void, TTo>
2203 static const bool value =
false;
2206 template <
typename TFrom>
2207 struct is_convertible_impl<TFrom, void>
2209 static const bool value =
false;
2213 struct is_convertible_impl<void, void>
2215 static const bool value =
true;
2219 template <
typename TFrom,
typename TTo>
2220 struct is_convertible : etl::bool_constant< private_type_traits::is_convertible_impl<TFrom, TTo>::value>
2226 template <
typename TFrom,
typename TTo>
2227 inline constexpr bool is_convertible_v = std::is_convertible_v<TFrom, TTo>;
2229 template <
typename TFrom,
typename TTo >
2230 inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<TFrom, TTo>::value;
2236 template <
typename T>
2237 struct alignment_of : std::alignment_of<T>
2241 struct alignment_of<void> : std::integral_constant<size_t, 0>
2245 struct alignment_of<const void> : std::integral_constant<size_t, 0>
2250 template <
typename T>
2251 inline constexpr size_t alignment_of_v = std::alignment_of_v<T>;
2264 template <
typename...>
2265 struct conjunction :
public etl::true_type
2269 template <
typename T1,
typename... Tn>
2270 struct conjunction<T1, Tn...> :
public etl::conditional_t<bool(T1::value), etl::conjunction<Tn...>, T1>
2274 template <
typename T>
2275 struct conjunction<T> :
public T
2281 template <
typename... T>
2282 inline constexpr bool conjunction_v = conjunction<T...>::value;
2288 template <
typename...>
2293 template <
typename T1,
typename... Tn>
2294 struct disjunction<T1, Tn...> :
public etl::conditional_t<bool(T1::value), T1, disjunction<Tn...>>
2298 template <
typename T1>
2299 struct disjunction<T1> :
public T1
2305 template <
typename... T>
2306 inline constexpr bool disjunction_v = etl::disjunction<T...>::value;
2314 template <
typename... TTypes>
2315 struct exclusive_disjunction;
2317 template <
typename T>
2318 struct exclusive_disjunction<T> :
public etl::bool_constant<T::value>
2323 template <
typename T1,
typename T2,
typename... TRest>
2324 struct exclusive_disjunction<T1, T2, TRest...>
2325 :
public etl::exclusive_disjunction< etl::integral_constant<bool, etl::disjunction<T1, T2>::value && !etl::conjunction<T1, T2>::value>, TRest...>
2331 template <
typename... T>
2332 inline constexpr bool exclusive_disjunction_v = etl::exclusive_disjunction<T...>::value;
2338 template <
bool BValue,
typename T, T TRUE_VALUE, T FALSE_VALUE>
2339 struct conditional_integral_constant;
2341 template <
typename T, T TRUE_VALUE, T FALSE_VALUE>
2342 struct conditional_integral_constant<true, T, TRUE_VALUE, FALSE_VALUE>
2344 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Not an integral type");
2345 static const T value = TRUE_VALUE;
2348 template <
typename T, T TRUE_VALUE, T FALSE_VALUE>
2349 struct conditional_integral_constant<false, T, TRUE_VALUE, FALSE_VALUE>
2351 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Not an integral type");
2352 static const T value = FALSE_VALUE;
2360 template <
typename T,
typename... TRest>
2361 struct is_one_of : etl::disjunction<etl::is_same<T, TRest>...>
2365 #include "private/type_traits_cpp03.h"
2369 template <
typename T,
typename... TRest>
2370 inline constexpr bool is_one_of_v = etl::is_one_of<T, TRest...>::value;
2374 namespace private_type_traits
2378 template <
typename T,
typename... TTypes>
2382 template <
typename T>
2383 struct count_type<T> : etl::integral_constant<size_t, 0>
2389 template <
typename T,
typename THead,
typename... TTail>
2390 struct count_type<T, THead, TTail...> : etl::integral_constant<size_t, (etl::is_same<T, THead>::value ? 1 : 0) + count_type<T, TTail...>::value>
2395 template <
typename T,
typename... TTypes>
2396 struct has_duplicates_of : etl::integral_constant< bool, (private_type_traits::count_type<T, TTypes...>::value > 1)>
2402 template <
typename T,
typename... TRest>
2403 inline constexpr bool has_duplicates_of_v = etl::has_duplicates_of<T, TRest...>::value;
2411 template <
typename TBase,
typename... TDerived>
2412 struct is_base_of_all : etl::conjunction<etl::is_base_of<TBase, TDerived>...>
2418 template <
typename T,
typename... TRest>
2419 inline constexpr bool is_base_of_all_v = etl::is_base_of_all<T, TRest...>::value;
2426 template <
typename TBase,
typename... TDerived>
2427 struct is_base_of_any : etl::disjunction<etl::is_base_of<TBase, TDerived>...>
2434 template <
typename T,
typename... TRest>
2435 inline constexpr bool is_base_of_any_v = etl::is_base_of_any<T, TRest...>::value;
2443 template <
size_t Index,
typename TType>
2446 typedef typename nth_base<Index - 1U,
typename TType::base_type>::type type;
2449 template <
typename TType>
2450 struct nth_base<0, TType>
2456 template <
size_t Index,
typename TType>
2457 using nth_base_t =
typename nth_base<Index, TType>::type;
2465 template <
typename T>
2470 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
2474 typedef type_t type;
2475 typedef type_t& reference;
2476 typedef const type_t& const_reference;
2477 typedef type_t* pointer;
2478 typedef const type_t* const_pointer;
2479 typedef const type_t*
const const_pointer_const;
2482 typedef type_t&& rvalue_reference;
2487 template <
typename T>
2492 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
2496 typedef type_t
type;
2498 typedef const type_t& const_reference;
2500 typedef const type_t* const_pointer;
2501 typedef const type_t*
const const_pointer_const;
2504 typedef type_t&& rvalue_reference;
2509 template <
typename T>
2510 struct types<T*
const>
2514 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
2518 typedef type_t
type;
2520 typedef const type_t& const_reference;
2522 typedef const type_t* const_pointer;
2523 typedef const type_t*
const const_pointer_const;
2526 typedef type_t&& rvalue_reference;
2531 template <
typename T>
2536 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
2540 typedef type_t
type;
2542 typedef const type_t& const_reference;
2544 typedef const type_t* const_pointer;
2545 typedef const type_t*
const const_pointer_const;
2548 typedef type_t&& rvalue_reference;
2554 template <
typename T>
2559 typedef typename etl::remove_reference<typename etl::remove_cv<T>::type>::type type_t;
2563 typedef type_t
type;
2565 typedef const type_t& const_reference;
2567 typedef const type_t* const_pointer;
2568 typedef const type_t*
const const_pointer_const;
2571 typedef type_t&& rvalue_reference;
2577 template <
typename T>
2578 using types_t =
typename types<T>::type;
2580 template <
typename T>
2581 using types_r =
typename types<T>::reference;
2583 template <
typename T>
2584 using types_cr =
typename types<T>::const_reference;
2586 template <
typename T>
2587 using types_rr =
typename types<T>::rvalue_reference;
2589 template <
typename T>
2590 using types_p =
typename types<T>::pointer;
2592 template <
typename T>
2593 using types_cp =
typename types<T>::const_pointer;
2595 template <
typename T>
2596 using types_cpc =
typename types<T>::const_pointer_const;
2602 template <
typename T>
2603 struct size_of : etl::integral_constant<size_t, sizeof(T)>
2607 struct size_of<void> : etl::integral_constant<size_t, 1U>
2612 template <
typename T>
2613 inline constexpr size_t size_of_v = etl::size_of<T>::value;
2619 template <
typename T,
typename... TRest>
2620 struct are_all_same : etl::conjunction<etl::is_same<T, TRest>...>
2626 template <
typename T,
typename... TRest>
2627 inline constexpr bool are_all_same_v = are_all_same<T, TRest...>::value;
2631#if ETL_USING_STL && ETL_USING_CPP11 && !defined(ETL_USE_TYPE_TRAITS_BUILTINS) && !defined(ETL_USER_DEFINED_TYPE_TRAITS) \
2632 && ((!defined(ARDUINO) && ETL_NOT_USING_STLPORT) || defined(ETL_GCC_V5_TYPE_TRAITS_SUPPORTED))
2640 template <
typename T1,
typename T2>
2641 using is_assignable = std::is_assignable<T1, T2>;
2645 template <
typename T,
typename... TArgs>
2646 using is_constructible = std::is_constructible<T, TArgs...>;
2650 template <
typename T>
2651 using is_copy_constructible = std::is_copy_constructible<T>;
2655 template <
typename T>
2656 using is_move_constructible = std::is_move_constructible<T>;
2660 template <
typename T>
2661 using is_copy_assignable = std::is_copy_assignable<T>;
2665 template <
typename T>
2666 using is_move_assignable = std::is_move_assignable<T>;
2670 template <
typename T,
typename... TArgs>
2671 using is_nothrow_constructible = std::is_nothrow_constructible<T, TArgs...>;
2675 template <
typename T>
2676 using is_nothrow_default_constructible = std::is_nothrow_default_constructible<T>;
2680 template <
typename T>
2681 using is_nothrow_copy_constructible = std::is_nothrow_copy_constructible<T>;
2685 template <
typename T>
2686 using is_nothrow_move_constructible = std::is_nothrow_move_constructible<T>;
2690 template <
typename T,
typename U>
2691 using is_nothrow_assignable = std::is_nothrow_assignable<T, U>;
2695 template <
typename T>
2696 using is_nothrow_copy_assignable = std::is_nothrow_copy_assignable<T>;
2700 template <
typename T>
2701 using is_nothrow_move_assignable = std::is_nothrow_move_assignable<T>;
2705 #if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
2706 template <
typename T>
2707 using is_trivially_constructible = std::is_trivially_constructible<T>;
2709 template <
typename T>
2710 using is_trivially_constructible = etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>;
2715 #if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
2716 template <
typename T>
2717 using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
2719 template <
typename T>
2720 using is_trivially_copy_constructible = etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>;
2725 #if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
2726 template <
typename T>
2727 using is_trivially_destructible = std::is_trivially_destructible<T>;
2729 template <
typename T>
2730 using is_trivially_destructible = etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>;
2735 #if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
2736 template <
typename T>
2737 using is_trivially_copy_assignable = std::is_trivially_copy_assignable<T>;
2739 template <
typename T>
2740 using is_trivially_copy_assignable = etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>;
2745 #if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
2746 template <
typename T>
2747 using is_trivially_copyable = std::is_trivially_copyable<T>;
2748 #elif ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE
2749 template <
typename T>
2750 using is_trivially_copyable = etl::bool_constant<__is_trivially_copyable(T)>;
2752 template <
typename T>
2753 using is_trivially_copyable = etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>;
2758 #if ETL_HAS_STD_TRIVIALLY_RELOCATABLE && ETL_USING_STL
2759 template <
typename T>
2760 using is_trivially_relocatable = std::is_trivially_relocatable<T>;
2761 #elif ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE
2762 template <
typename T>
2763 using is_trivially_relocatable = etl::bool_constant<__builtin_is_cpp_trivially_relocatable(T)>;
2764 #elif ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE
2765 template <
typename T>
2766 using is_trivially_relocatable = etl::bool_constant<__is_trivially_relocatable(T)>;
2768 template <
typename T>
2769 using is_trivially_relocatable = etl::bool_constant<etl::is_trivially_copyable<T>::value && etl::is_trivially_destructible<T>::value>;
2776 #if ETL_HAS_STD_TRIVIALLY_RELOCATABLE && ETL_USING_STL
2777 template <
typename T>
2778 using is_nothrow_relocatable = std::is_nothrow_relocatable<T>;
2780 template <
typename T>
2781 using is_nothrow_relocatable = etl::bool_constant< etl::is_trivially_relocatable<T>::value
2782 || (std::is_nothrow_move_constructible<typename etl::remove_all_extents<T>::type>::value
2783 && std::is_nothrow_destructible<typename etl::remove_all_extents<T>::type>::value)>;
2786 template <
typename T>
2787 using is_nothrow_relocatable = etl::is_trivially_relocatable<T>;
2790#elif defined(ETL_USE_TYPE_TRAITS_BUILTINS) && !defined(ETL_USER_DEFINED_TYPE_TRAITS)
2798 template <
typename T1,
typename T2>
2799 struct is_assignable
2801 static ETL_CONSTANT
bool value = __is_assignable(T1, T2);
2807 template <
typename T,
typename... TArgs>
2808 struct is_constructible
2810 static ETL_CONSTANT
bool value = __is_constructible(T, TArgs...);
2815 template <
typename T,
typename TArgs =
void>
2816 struct is_constructible
2818 static ETL_CONSTANT
bool value = __is_constructible(T, TArgs);
2823 template <
typename T>
2824 struct is_constructible<T, void>
2826 static ETL_CONSTANT
bool value = __is_constructible(T);
2832 template <
typename T>
2833 struct is_copy_constructible :
public etl::is_constructible< T, typename etl::add_lvalue_reference<const T>::type>
2839 template <
typename T>
2840 struct is_move_constructible :
public etl::is_constructible<T, T>
2846 template <
typename T>
2847 struct is_copy_assignable
2848 :
public etl::is_assignable< typename etl::add_lvalue_reference<T>::type, typename etl::add_lvalue_reference<const T>::type>
2855 template <
typename T>
2856 struct is_move_assignable :
public etl::is_assignable<typename etl::add_lvalue_reference<T>::type, typename etl::add_rvalue_reference<T>::type>
2860 template <
typename T>
2861 struct is_move_assignable :
public etl::is_assignable<typename etl::add_lvalue_reference<T>::type, T>
2869 template <
typename T,
typename... TArgs>
2870 struct is_nothrow_constructible
2872 #if ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE
2873 static ETL_CONSTANT
bool value = __is_nothrow_constructible(T, TArgs...);
2875 static ETL_CONSTANT
bool value = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value;
2881 template <
typename T>
2882 struct is_nothrow_default_constructible :
public etl::is_nothrow_constructible<T>
2888 template <
typename T>
2889 struct is_nothrow_copy_constructible :
public etl::is_nothrow_constructible<T, typename etl::add_lvalue_reference<const T>::type>
2895 template <
typename T>
2896 struct is_nothrow_move_constructible :
public etl::is_nothrow_constructible<T, typename etl::add_rvalue_reference<T>::type>
2904 template <
typename T,
typename U>
2905 struct is_nothrow_assignable
2907 #if ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE
2908 static ETL_CONSTANT
bool value = __is_nothrow_assignable(T, U);
2910 static ETL_CONSTANT
bool value = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value;
2916 template <
typename T>
2917 struct is_nothrow_copy_assignable
2918 :
public etl::is_nothrow_assignable<typename etl::add_lvalue_reference<T>::type, typename etl::add_lvalue_reference<const T>::type>
2924 template <
typename T>
2925 struct is_nothrow_move_assignable
2926 :
public etl::is_nothrow_assignable<typename etl::add_lvalue_reference<T>::type, typename etl::add_rvalue_reference<T>::type>
2934 template <
typename T,
typename... TArgs>
2935 struct is_trivially_constructible
2937 #if defined(ETL_COMPILER_GCC)
2938 static ETL_CONSTANT
bool value = __has_trivial_constructor(T);
2940 static ETL_CONSTANT
bool value = __is_trivially_constructible(T, TArgs...);
2946 template <
typename T,
typename TArgs =
void>
2947 struct is_trivially_constructible
2949 #if defined(ETL_COMPILER_GCC)
2950 static ETL_CONSTANT
bool value = __has_trivial_constructor(T);
2952 static ETL_CONSTANT
bool value = __is_trivially_constructible(T, TArgs);
2958 template <
typename T>
2959 struct is_trivially_constructible<T, void>
2961 #if defined(ETL_COMPILER_GCC)
2962 static ETL_CONSTANT
bool value = __has_trivial_constructor(T);
2964 static ETL_CONSTANT
bool value = __is_trivially_constructible(T);
2971 template <
typename T>
2972 struct is_trivially_copy_constructible :
public is_trivially_constructible< T, typename add_lvalue_reference<const T>::type>
2978 template <
typename T>
2979 struct is_trivially_destructible
2981 #if defined(ETL_COMPILER_GCC)
2982 static ETL_CONSTANT
bool value = __has_trivial_destructor(T);
2984 static ETL_CONSTANT
bool value = __is_trivially_destructible(T);
2990 template <
typename T>
2991 struct is_trivially_copy_assignable
2993 #if defined(ETL_COMPILER_GCC)
2994 static ETL_CONSTANT
bool value = __has_trivial_copy(T);
2996 static ETL_CONSTANT
bool value = __is_trivially_copyable(T);
3002 template <
typename T>
3003 struct is_trivially_copyable
3005 static ETL_CONSTANT
bool value = __is_trivially_copyable(T);
3010 template <
typename T>
3011 struct is_trivially_relocatable
3013 #if ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE
3014 static ETL_CONSTANT
bool value = __builtin_is_cpp_trivially_relocatable(T);
3015 #elif ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE
3016 static ETL_CONSTANT
bool value = __is_trivially_relocatable(T);
3018 static ETL_CONSTANT
bool value = etl::is_trivially_copyable<T>::value && etl::is_trivially_destructible<T>::value;
3026 template <
typename T>
3027 struct is_nothrow_relocatable
3030 static ETL_CONSTANT
bool value = etl::is_trivially_relocatable<T>::value;
3033#elif defined(ETL_USER_DEFINED_TYPE_TRAITS) && !defined(ETL_USE_TYPE_TRAITS_BUILTINS)
3042 template <
typename T1,
typename T2,
3044 (etl::is_arithmetic<T1>::value || etl::is_pointer<T1>::value) && (etl::is_arithmetic<T2>::value || etl::is_pointer<T2>::value)>
3045 struct is_assignable;
3047 template <
typename T1,
typename T2>
3048 struct is_assignable<T1, T2, true> :
public etl::true_type
3052 template <
typename T1,
typename T2>
3053 struct is_assignable<T1, T2, false>;
3058 template <
typename T,
bool BValue,
typename... TArgs>
3059 struct is_constructible_helper;
3061 template <
typename T,
typename... TArgs>
3062 struct is_constructible_helper<T, true, TArgs...> :
public etl::true_type
3066 template <
typename T,
typename... TArgs>
3067 struct is_constructible_helper<T, false, TArgs...>;
3069 template <
typename T,
typename... TArgs>
3070 struct is_constructible :
public is_constructible_helper< T, etl::is_arithmetic<T>::value || etl::is_pointer<T>::value, TArgs...>
3077 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3078 struct is_copy_constructible;
3080 template <
typename T>
3081 struct is_copy_constructible<T, true> :
public etl::true_type
3085 template <
typename T>
3086 struct is_copy_constructible<T, false>;
3090 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3091 struct is_move_constructible;
3093 template <
typename T>
3094 struct is_move_constructible<T, true> :
public etl::true_type
3098 template <
typename T>
3099 struct is_move_constructible<T, false>;
3103 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3104 struct is_copy_assignable;
3106 template <
typename T>
3107 struct is_copy_assignable<T, true> :
public etl::true_type
3111 template <
typename T>
3112 struct is_copy_assignable<T, false>;
3116 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3117 struct is_move_assignable;
3119 template <
typename T>
3120 struct is_move_assignable<T, true> :
public etl::true_type
3124 template <
typename T>
3125 struct is_move_assignable<T, false>;
3130 template <
typename T,
bool BValue,
typename... TArgs>
3131 struct is_nothrow_constructible_helper;
3133 template <
typename T,
typename... TArgs>
3134 struct is_nothrow_constructible_helper<T, true, TArgs...> :
public etl::true_type
3138 template <
typename T,
typename... TArgs>
3139 struct is_nothrow_constructible_helper<T, false, TArgs...>;
3141 template <
typename T,
typename... TArgs>
3142 struct is_nothrow_constructible :
public is_nothrow_constructible_helper<T, etl::is_arithmetic<T>::value || etl::is_pointer<T>::value, TArgs...>
3148 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3149 struct is_nothrow_default_constructible;
3151 template <
typename T>
3152 struct is_nothrow_default_constructible<T, true> :
public etl::true_type
3156 template <
typename T>
3157 struct is_nothrow_default_constructible<T, false>;
3161 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3162 struct is_nothrow_copy_constructible;
3164 template <
typename T>
3165 struct is_nothrow_copy_constructible<T, true> :
public etl::true_type
3169 template <
typename T>
3170 struct is_nothrow_copy_constructible<T, false>;
3174 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3175 struct is_nothrow_move_constructible;
3177 template <
typename T>
3178 struct is_nothrow_move_constructible<T, true> :
public etl::true_type
3182 template <
typename T>
3183 struct is_nothrow_move_constructible<T, false>;
3187 template <typename T, typename U, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3188 struct is_nothrow_assignable;
3190 template <
typename T,
typename U>
3191 struct is_nothrow_assignable<T, U, true> :
public etl::true_type
3195 template <
typename T,
typename U>
3196 struct is_nothrow_assignable<T, U, false>;
3200 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3201 struct is_nothrow_copy_assignable;
3203 template <
typename T>
3204 struct is_nothrow_copy_assignable<T, true> :
public etl::true_type
3208 template <
typename T>
3209 struct is_nothrow_copy_assignable<T, false>;
3213 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3214 struct is_nothrow_move_assignable;
3216 template <
typename T>
3217 struct is_nothrow_move_assignable<T, true> :
public etl::true_type
3221 template <
typename T>
3222 struct is_nothrow_move_assignable<T, false>;
3227 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3228 struct is_trivially_constructible;
3230 template <
typename T>
3231 struct is_trivially_constructible<T, true> :
public etl::true_type
3235 template <
typename T>
3236 struct is_trivially_constructible<T, false>;
3240 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3241 struct is_trivially_copy_constructible;
3243 template <
typename T>
3244 struct is_trivially_copy_constructible<T, true> :
public etl::true_type
3248 template <
typename T>
3249 struct is_trivially_copy_constructible<T, false>;
3253 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3254 struct is_trivially_destructible;
3256 template <
typename T>
3257 struct is_trivially_destructible<T, true> :
public etl::true_type
3261 template <
typename T>
3262 struct is_trivially_destructible<T, false>;
3266 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3267 struct is_trivially_copy_assignable;
3269 template <
typename T>
3270 struct is_trivially_copy_assignable<T, true> :
public etl::true_type
3274 template <
typename T>
3275 struct is_trivially_copy_assignable<T, false>;
3279 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3280 struct is_trivially_copyable;
3282 template <
typename T>
3283 struct is_trivially_copyable<T, true> :
public etl::true_type
3287 template <
typename T>
3288 struct is_trivially_copyable<T, false>;
3292 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3293 struct is_trivially_relocatable;
3295 template <
typename T>
3296 struct is_trivially_relocatable<T, true> :
public etl::true_type
3300 template <
typename T>
3301 struct is_trivially_relocatable<T, false>;
3306 template <typename T, bool BValue = etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3307 struct is_nothrow_relocatable;
3309 template <
typename T>
3310 struct is_nothrow_relocatable<T, true> :
public etl::true_type
3314 template <
typename T>
3315 struct is_nothrow_relocatable<T, false>;
3326 template <
typename T1,
typename T2>
3327 #if ETL_USING_BUILTIN_IS_ASSIGNABLE
3328 struct is_assignable :
public etl::bool_constant<__is_assignable(T1, T2)>
3330 struct is_assignable
3331 :
public etl::bool_constant< (etl::is_arithmetic<T1>::value || etl::is_pointer<T1>::value)
3332 && (etl::is_arithmetic<T2>::value || etl::is_pointer<T2>::value)>
3340 namespace private_type_traits
3342 template <
class,
class T,
class... TArgs>
3347 template <
class T,
class... TArgs>
3348 struct is_constructible_<void_t<decltype(T(etl::declval<TArgs>()...))>, T, TArgs...> : etl::true_type
3355 template <
class T,
class... TArgs>
3356 using is_constructible = private_type_traits::is_constructible_<void_t<>, T, TArgs...>;
3361 struct is_copy_constructible :
public is_constructible< T, typename etl::add_lvalue_reference< typename etl::add_const<T>::type>::type>
3365 struct is_copy_constructible<void> :
public false_type
3369 struct is_copy_constructible<void const> :
public false_type
3373 struct is_copy_constructible<void volatile> :
public false_type
3377 struct is_copy_constructible<void const volatile> :
public false_type
3383 template <
typename T>
3384 struct is_move_constructible :
public is_constructible<T, typename etl::add_rvalue_reference<T>::type>
3388 struct is_move_constructible<void> :
public false_type
3392 struct is_move_constructible<void const> :
public false_type
3396 struct is_move_constructible<void volatile> :
public false_type
3400 struct is_move_constructible<void const volatile> :
public false_type
3408 template <
typename T>
3409 struct is_copy_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3415 template <
typename T>
3416 struct is_move_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3423 template <
typename T>
3424 struct is_copy_assignable
3425 :
public etl::is_assignable< typename etl::add_lvalue_reference<T>::type, typename etl::add_lvalue_reference<const T>::type>
3432 template <
typename T>
3433 struct is_move_assignable :
public etl::is_assignable<typename etl::add_lvalue_reference<T>::type, typename etl::add_rvalue_reference<T>::type>
3439 template <
typename T>
3440 struct is_move_assignable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3448 template <
typename T,
typename... TArgs>
3449 struct is_nothrow_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3455 template <
typename T>
3456 struct is_nothrow_default_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3462 template <
typename T>
3463 struct is_nothrow_copy_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3469 template <
typename T>
3470 struct is_nothrow_move_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3476 template <
typename T,
typename U>
3477 struct is_nothrow_assignable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3483 template <
typename T>
3484 struct is_nothrow_copy_assignable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3490 template <
typename T>
3491 struct is_nothrow_move_assignable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3498 template <
typename T>
3499 struct is_trivially_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3505 template <
typename T>
3506 struct is_trivially_copy_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3512 template <
typename T>
3513 struct is_trivially_destructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3519 template <
typename T>
3520 struct is_trivially_copy_assignable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3526 template <
typename T>
3527 #if ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE
3528 struct is_trivially_copyable :
public etl::bool_constant<__is_trivially_copyable(T)>
3530 struct is_trivially_copyable :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3537 template <
typename T>
3538 #if ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE
3539 struct is_trivially_relocatable :
public etl::bool_constant<__builtin_is_cpp_trivially_relocatable(T)>
3540 #elif ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE
3541 struct is_trivially_relocatable :
public etl::bool_constant<__is_trivially_relocatable(T)>
3543 struct is_trivially_relocatable :
public etl::bool_constant<etl::is_trivially_copyable<T>::value && etl::is_trivially_destructible<T>::value>
3551 template <
typename T>
3552 struct is_nothrow_relocatable :
public etl::is_trivially_relocatable<T>
3558 template <
typename T1,
typename T2>
3559 struct is_lvalue_assignable
3560 :
public etl::is_assignable< typename etl::add_lvalue_reference<T1>::type,
3561 typename etl::add_lvalue_reference< typename etl::add_const<T2>::type>::type>
3568 template <
typename T,
typename =
void>
3573 template <
typename T>
3574 struct is_default_constructible<T, etl::void_t<decltype(T())>> : etl::true_type
3578 template <
typename T>
3579 struct is_default_constructible :
public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
3586 template <
typename T1,
typename T2>
3587 inline constexpr bool is_assignable_v = etl::is_assignable<T1, T2>::value;
3589 template <
typename T1,
typename T2>
3590 inline constexpr bool is_lvalue_assignable_v = etl::is_lvalue_assignable<T1, T2>::value;
3592 template <
typename T,
typename... TArgs>
3593 inline constexpr bool is_constructible_v = etl::is_constructible<T, TArgs...>::value;
3595 template <
typename T,
typename... TArgs>
3596 inline constexpr bool is_default_constructible_v = etl::is_default_constructible<T, TArgs...>::value;
3598 template <
typename T>
3599 inline constexpr bool is_copy_constructible_v = etl::is_copy_constructible<T>::value;
3601 template <
typename T>
3602 inline constexpr bool is_move_constructible_v = etl::is_move_constructible<T>::value;
3604 template <
typename T>
3605 inline constexpr bool is_copy_assignable_v = etl::is_copy_assignable<T>::value;
3607 template <
typename T>
3608 inline constexpr bool is_move_assignable_v = etl::is_move_assignable<T>::value;
3610 template <
typename T,
typename... TArgs>
3611 inline constexpr bool is_nothrow_constructible_v = etl::is_nothrow_constructible<T, TArgs...>::value;
3613 template <
typename T>
3614 inline constexpr bool is_nothrow_default_constructible_v = etl::is_nothrow_default_constructible<T>::value;
3616 template <
typename T>
3617 inline constexpr bool is_nothrow_copy_constructible_v = etl::is_nothrow_copy_constructible<T>::value;
3619 template <
typename T>
3620 inline constexpr bool is_nothrow_move_constructible_v = etl::is_nothrow_move_constructible<T>::value;
3622 template <
typename T,
typename U>
3623 inline constexpr bool is_nothrow_assignable_v = etl::is_nothrow_assignable<T, U>::value;
3625 template <
typename T>
3626 inline constexpr bool is_nothrow_copy_assignable_v = etl::is_nothrow_copy_assignable<T>::value;
3628 template <
typename T>
3629 inline constexpr bool is_nothrow_move_assignable_v = etl::is_nothrow_move_assignable<T>::value;
3631 template <
typename T>
3632 inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible<T>::value;
3634 template <
typename T>
3635 inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible<T>::value;
3637 template <
typename T>
3638 inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible<T>::value;
3640 template <
typename T>
3641 inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable<T>::value;
3643 template <
typename T>
3644 inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable<T>::value;
3646 template <
typename T>
3647 inline constexpr bool is_trivially_relocatable_v = etl::is_trivially_relocatable<T>::value;
3649 template <
typename T>
3650 inline constexpr bool is_nothrow_relocatable_v = etl::is_nothrow_relocatable<T>::value;
3662 template <
typename...>
3669 template <
typename T>
3670 struct common_type<T> : common_type<T, T>
3674 namespace private_common_type
3676 template <
typename T1,
typename T2>
3677 using conditional_result_t =
decltype(
false ? declval<T1>() : declval<T2>());
3679 template <
typename,
typename,
typename =
void>
3680 struct decay_conditional_result
3684 template <
typename T1,
typename T2>
3685 struct decay_conditional_result<T1, T2, void_t<conditional_result_t<T1, T2>>> : etl::decay<conditional_result_t<T1, T2>>
3689 template <
typename T1,
typename T2,
typename =
void>
3690 struct common_type_2_impl : decay_conditional_result<const T1&, const T2&>
3694 template <
typename T1,
typename T2>
3695 struct common_type_2_impl<T1, T2, void_t<conditional_result_t<T1, T2>>> : decay_conditional_result<T1, T2>
3702 template <
typename T1,
typename T2>
3703 struct common_type<T1, T2>
3704 : etl::conditional< etl::is_same<T1, typename etl::decay<T1>::type>::value && etl::is_same<T2, typename etl::decay<T2>::type>::value,
3705 private_common_type::common_type_2_impl<T1, T2>,
3706 common_type<typename etl::decay<T2>::type, typename etl::decay<T2>::type>>::type
3712 namespace private_common_type
3714 template <
typename AlwaysVoid,
typename T1,
typename T2,
typename... TRest>
3715 struct common_type_multi_impl
3719 template <
typename T1,
typename T2,
typename... TRest>
3720 struct common_type_multi_impl<void_t<typename common_type<T1, T2>::type>, T1, T2, TRest...>
3721 : common_type<typename common_type<T1, T2>::type, TRest...>
3726 template <
typename T1,
typename T2,
typename... TRest>
3727 struct common_type<T1, T2, TRest...> : private_common_type::common_type_multi_impl<void, T1, T2, TRest...>
3731 template <
typename... T>
3732 using common_type_t =
typename common_type<T...>::type;
3738 template <
typename T>
3739 struct unsigned_type
3741 typedef typename etl::conditional<
3742 sizeof(T) ==
sizeof(
unsigned char),
unsigned char,
3743 typename etl::conditional<
sizeof(T) ==
sizeof(
unsigned short),
unsigned short,
3744 typename etl::conditional<
sizeof(T) ==
sizeof(
unsigned int),
unsigned int,
3745 typename etl::conditional<
sizeof(T) ==
sizeof(
unsigned long),
unsigned long,
3746 unsigned long long>::type>::type>::type>::type type;
3750 template <
typename T>
3751 using unsigned_type_t =
typename unsigned_type<T>::type;
3757 template <
typename T>
3760 typedef typename etl::conditional<
3761 sizeof(T) ==
sizeof(char), char,
3762 typename etl::conditional<
3763 sizeof(T) ==
sizeof(short), short,
3764 typename etl::conditional<
sizeof(T) ==
sizeof(int), int,
3765 typename etl::conditional<
sizeof(T) ==
sizeof(long), long,
long long>::type>::type>::type>::type type;
3769 template <
typename T>
3770 using signed_type_t =
typename signed_type<T>::type;
3776 template <
typename T>
3777 struct type_identity
3783 template <
typename T>
3784 using type_identity_t =
typename type_identity<T>::type;
3789#if ETL_USING_BUILTIN_UNDERLYING_TYPE
3791 template <typename T, bool = etl::is_enum<T>::value>
3792 struct underlying_type;
3795 template <
typename T>
3796 struct underlying_type<T, false>
3799 ETL_STATIC_ASSERT(etl::is_enum<T>::value,
"etl::underlying_type can only be used with enumeration types.");
3802 template <
typename T>
3803 struct underlying_type<T, true>
3805 typedef __underlying_type(T) type;
3810 template <
typename T>
3811 struct underlying_type
3818 template <
typename T>
3819 using underlying_type_t =
typename underlying_type<T>::type;
3825 template <
typename... TTypes>
3826 struct has_duplicates;
3828 template <
typename TFirst,
typename... TRest>
3829 struct has_duplicates<TFirst, TRest...> : etl::conditional_t<etl::is_one_of<TFirst, TRest...>::value, etl::true_type, has_duplicates<TRest...>>
3833 template <
typename T>
3845 template <
typename... TTypes>
3846 inline constexpr bool has_duplicates_v = etl::has_duplicates<TTypes...>::value;
3852 template <
typename T,
typename... TTypes>
3855 template <
typename T,
typename U,
typename... URest>
3856 struct count_of<T, U, URest...> : etl::integral_constant<size_t, etl::is_same<T, U>::value + count_of<T, URest...>::value>
3860 template <
typename T>
3861 struct count_of<T> : etl::integral_constant<size_t, 0>
3867 template <
typename T,
typename... TTypes>
3868 inline constexpr size_t count_of_v = etl::count_of<T, TTypes...>::value;
3874 template <
typename T,
template <
typename...>
class Template>
3879 template <
template <
typename...>
class Template,
typename... TArgs>
3880 struct is_specialization<Template<TArgs...>, Template> : etl::true_type
3886 template <
typename T,
template <
typename...>
class Template>
3887 inline constexpr bool is_specialization_v = etl::is_specialization<T, Template>::value;
3892 ETL_CONSTEXPR
inline bool is_constant_evaluated() ETL_NOEXCEPT
3903#elif ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED == 1
3905 return __builtin_is_constant_evaluated();
3915 namespace private_type_traits
3917 template <
typename T>
3922 template <
typename T,
typename TObject>
3923 struct is_member_pointer_helper<T TObject::*> : etl::true_type
3928 template <
typename T>
3929 struct is_member_pointer : private_type_traits::is_member_pointer_helper< typename etl::remove_cv<T>::type>
3934 template <
typename T>
3935 inline constexpr bool is_member_pointer_v = etl::is_member_pointer<T>::value;
3942 template <
typename T>
3948 template <
typename TReturn,
typename... TArgs>
3949 struct is_function<TReturn(TArgs...)> : etl::true_type
3953 template <
typename TReturn,
typename... TArgs>
3954 struct is_function<TReturn(TArgs...) const> : etl::true_type
3958 template <
typename TReturn,
typename... TArgs>
3959 struct is_function<TReturn(TArgs...) volatile> : etl::true_type
3963 template <
typename TReturn,
typename... TArgs>
3964 struct is_function<TReturn(TArgs...) const volatile> : etl::true_type
3969 template <
typename TReturn,
typename... TArgs>
3970 struct is_function<TReturn(TArgs..., ...)> : etl::true_type
3974 template <
typename TReturn,
typename... TArgs>
3975 struct is_function<TReturn(TArgs..., ...) const> : etl::true_type
3979 template <
typename TReturn,
typename... TArgs>
3980 struct is_function<TReturn(TArgs..., ...) volatile> : etl::true_type
3984 template <
typename TReturn,
typename... TArgs>
3985 struct is_function<TReturn(TArgs..., ...) const volatile> : etl::true_type
3990 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
3991 template <
typename TReturn,
typename... TArgs>
3992 struct is_function<TReturn(TArgs...) noexcept> : etl::true_type
3996 template <
typename TReturn,
typename... TArgs>
3997 struct is_function<TReturn(TArgs...) const noexcept> : etl::true_type
4001 template <
typename TReturn,
typename... TArgs>
4002 struct is_function<TReturn(TArgs...) volatile noexcept> : etl::true_type
4006 template <
typename TReturn,
typename... TArgs>
4007 struct is_function<TReturn(TArgs...) const volatile noexcept> : etl::true_type
4011 template <
typename TReturn,
typename... TArgs>
4012 struct is_function<TReturn(TArgs..., ...) noexcept> : etl::true_type
4016 template <
typename TReturn,
typename... TArgs>
4017 struct is_function<TReturn(TArgs..., ...) const noexcept> : etl::true_type
4021 template <
typename TReturn,
typename... TArgs>
4022 struct is_function<TReturn(TArgs..., ...) volatile noexcept> : etl::true_type
4026 template <
typename TReturn,
typename... TArgs>
4027 struct is_function<TReturn(TArgs..., ...) const volatile noexcept> : etl::true_type
4033 template <
typename T>
4034 inline constexpr bool is_function_v = etl::is_function<T>::value;
4039 template <
typename T>
4040 struct is_function : etl::bool_constant<!etl::is_member_pointer<T>::value && !etl::is_const<const T>::value && !etl::is_reference<T>::value>
4049 template <
typename T>
4050 struct is_object : etl::bool_constant<!etl::is_function<T>::value && !etl::is_reference<T>::value && !etl::is_void<T>::value>
4055 template <
typename T>
4056 inline constexpr bool is_object_v = etl::is_object<T>::value;
4062 template <
typename T>
4063 struct is_object_pointer : etl::bool_constant<etl::is_pointer<T>::value && etl::is_object<typename etl::remove_pointer<T>::type>::value>
4068 template <
typename T>
4069 inline constexpr bool is_object_pointer_v = etl::is_object_pointer<T>::value;
4076 template <
typename T, etl::enable_if_t<etl::is_
class<etl::decay_t<T>>::value,
int> = 0>
4077 struct has_call_operator
4079 template <
typename U>
4080 static auto test(
int) ->
decltype(&U::operator(), etl::true_type());
4085 static const bool value = etl::is_same<decltype(test<T>(0)), etl::true_type>::value;
4089 template <
typename T>
4090 inline constexpr bool has_call_operator_v = etl::has_call_operator<T>::value;
4098 template <
typename T, etl::enable_if_t<etl::is_
class<etl::decay_t<T>>::value,
int> = 0>
4099 struct has_unique_call_operator
4104 template <
typename U>
4105 static auto test(
int) ->
decltype(&U::operator(), etl::true_type());
4116 static constexpr bool value =
decltype(test<etl::decay_t<T>>(0))::value;
4120 template <
typename T>
4121 inline constexpr bool has_unique_call_operator_v = etl::has_unique_call_operator<T>::value;
4129 template <
typename T>
4134 template <
typename TReturn,
typename TObject,
typename... TArgs>
4135 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...)> : etl::true_type
4138 template <
typename TReturn,
typename TObject,
typename... TArgs>
4139 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const> : etl::true_type
4142 template <
typename TReturn,
typename TObject,
typename... TArgs>
4143 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) volatile> : etl::true_type
4146 template <
typename TReturn,
typename TObject,
typename... TArgs>
4147 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const volatile> : etl::true_type
4151 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
4152 template <
typename TReturn,
typename TObject,
typename... TArgs>
4153 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) noexcept> : etl::true_type
4156 template <
typename TReturn,
typename TObject,
typename... TArgs>
4157 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const noexcept> : etl::true_type
4160 template <
typename TReturn,
typename TObject,
typename... TArgs>
4161 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) volatile noexcept> : etl::true_type
4164 template <
typename TReturn,
typename TObject,
typename... TArgs>
4165 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const volatile noexcept> : etl::true_type
4170 template <
typename TReturn,
typename TObject,
typename... TArgs>
4171 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...)&> : etl::true_type
4174 template <
typename TReturn,
typename TObject,
typename... TArgs>
4175 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const&> : etl::true_type
4178 template <
typename TReturn,
typename TObject,
typename... TArgs>
4179 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) volatile&> : etl::true_type
4182 template <
typename TReturn,
typename TObject,
typename... TArgs>
4183 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const volatile&> : etl::true_type
4187 template <
typename TReturn,
typename TObject,
typename... TArgs>
4188 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) &&> : etl::true_type
4191 template <
typename TReturn,
typename TObject,
typename... TArgs>
4192 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const&&> : etl::true_type
4195 template <
typename TReturn,
typename TObject,
typename... TArgs>
4196 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) volatile&&> : etl::true_type
4199 template <
typename TReturn,
typename TObject,
typename... TArgs>
4200 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const volatile&&> : etl::true_type
4204 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
4205 template <
typename TReturn,
typename TObject,
typename... TArgs>
4206 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) & noexcept> : etl::true_type
4209 template <
typename TReturn,
typename TObject,
typename... TArgs>
4210 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const & noexcept> : etl::true_type
4213 template <
typename TReturn,
typename TObject,
typename... TArgs>
4214 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) volatile & noexcept> : etl::true_type
4217 template <
typename TReturn,
typename TObject,
typename... TArgs>
4218 struct is_member_function_pointer< TReturn (TObject::*)(TArgs...) const volatile & noexcept> : etl::true_type
4222 template <
typename TReturn,
typename TObject,
typename... TArgs>
4223 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) && noexcept> : etl::true_type
4226 template <
typename TReturn,
typename TObject,
typename... TArgs>
4227 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) const && noexcept> : etl::true_type
4230 template <
typename TReturn,
typename TObject,
typename... TArgs>
4231 struct is_member_function_pointer<TReturn (TObject::*)(TArgs...) volatile && noexcept> : etl::true_type
4234 template <
typename TReturn,
typename TObject,
typename... TArgs>
4235 struct is_member_function_pointer< TReturn (TObject::*)(TArgs...) const volatile && noexcept> : etl::true_type
4240 template <
typename TReturn,
typename TObject,
typename... TArgs>
4241 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...)> : etl::true_type
4244 template <
typename TReturn,
typename TObject,
typename... TArgs>
4245 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const> : etl::true_type
4248 template <
typename TReturn,
typename TObject,
typename... TArgs>
4249 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) volatile> : etl::true_type
4252 template <
typename TReturn,
typename TObject,
typename... TArgs>
4253 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const volatile> : etl::true_type
4257 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
4258 template <
typename TReturn,
typename TObject,
typename... TArgs>
4259 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) noexcept> : etl::true_type
4262 template <
typename TReturn,
typename TObject,
typename... TArgs>
4263 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const noexcept> : etl::true_type
4266 template <
typename TReturn,
typename TObject,
typename... TArgs>
4267 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) volatile noexcept> : etl::true_type
4270 template <
typename TReturn,
typename TObject,
typename... TArgs>
4271 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const volatile noexcept> : etl::true_type
4276 template <
typename TReturn,
typename TObject,
typename... TArgs>
4277 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...)&> : etl::true_type
4280 template <
typename TReturn,
typename TObject,
typename... TArgs>
4281 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const&> : etl::true_type
4284 template <
typename TReturn,
typename TObject,
typename... TArgs>
4285 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) volatile&> : etl::true_type
4288 template <
typename TReturn,
typename TObject,
typename... TArgs>
4289 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const volatile&> : etl::true_type
4292 template <
typename TReturn,
typename TObject,
typename... TArgs>
4293 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) &&> : etl::true_type
4296 template <
typename TReturn,
typename TObject,
typename... TArgs>
4297 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const&&> : etl::true_type
4300 template <
typename TReturn,
typename TObject,
typename... TArgs>
4301 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) volatile&&> : etl::true_type
4304 template <
typename TReturn,
typename TObject,
typename... TArgs>
4305 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const volatile&&> : etl::true_type
4309 #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE
4310 template <
typename TReturn,
typename TObject,
typename... TArgs>
4311 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) & noexcept> : etl::true_type
4314 template <
typename TReturn,
typename TObject,
typename... TArgs>
4315 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const & noexcept> : etl::true_type
4318 template <
typename TReturn,
typename TObject,
typename... TArgs>
4319 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) volatile & noexcept> : etl::true_type
4322 template <
typename TReturn,
typename TObject,
typename... TArgs>
4323 struct is_member_function_pointer< TReturn (TObject::*)(TArgs..., ...) const volatile & noexcept> : etl::true_type
4327 template <
typename TReturn,
typename TObject,
typename... TArgs>
4328 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) && noexcept> : etl::true_type
4331 template <
typename TReturn,
typename TObject,
typename... TArgs>
4332 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) const && noexcept> : etl::true_type
4335 template <
typename TReturn,
typename TObject,
typename... TArgs>
4336 struct is_member_function_pointer<TReturn (TObject::*)(TArgs..., ...) volatile && noexcept> : etl::true_type
4339 template <
typename TReturn,
typename TObject,
typename... TArgs>
4340 struct is_member_function_pointer< TReturn (TObject::*)(TArgs..., ...) const volatile && noexcept> : etl::true_type
4347 template <
typename T>
4348 inline constexpr bool is_member_function_pointer_v = etl::is_member_function_pointer<T>::value;
4355 namespace private_type_traits
4362 template <
typename T,
typename TObject>
4363 struct is_member_object_pointer_helper<T TObject::*> :
public etl::negation<etl::is_function<T>>
4368 template <
typename T>
4369 struct is_member_object_pointer :
public private_type_traits::is_member_object_pointer_helper< etl::remove_cv_t<T>>::type
4375 template <
typename T>
4376 inline constexpr bool is_member_object_pointer_v = etl::is_member_object_pointer<T>::value;
4380 template <
class... TArgs>
4381 struct common_reference;
4383 template <
class... TArgs>
4384 using common_reference_t =
typename etl::common_reference<TArgs...>::type;
4386 template <
class T,
class U,
template <
class>
class TQual,
template <
class>
class UQual>
4387 struct basic_common_reference
4393 struct common_reference<>
4399 struct common_reference<T>
4404 namespace private_type_traits
4406 template <
class T1,
class T2>
4407 using cond_res =
decltype(
false ? etl::declval<T1 (&)()>()() : etl::declval<T2 (&)()>()());
4409 template <
class From>
4416 template <
class From>
4417 struct copy_cv<const From>
4420 using apply =
const To;
4423 template <
class From>
4424 struct copy_cv<volatile From>
4427 using apply =
volatile To;
4430 template <
class From>
4431 struct copy_cv<const volatile From>
4434 using apply =
const volatile To;
4437 template <
class From,
class To>
4438 using copy_cv_t =
typename copy_cv<From>::template apply<To>;
4440 template <
class From>
4444 using apply = copy_cv_t<From, To>;
4447 template <
class From>
4448 struct copy_cvref<From&>
4451 using apply = add_lvalue_reference_t<copy_cv_t<From, To>>;
4454 template <
class From>
4455 struct copy_cvref<From&&>
4458 using apply = add_lvalue_reference_t<copy_cv_t<From, To>>;
4461 template <
class From,
class To>
4462 using copy_cvref_t =
typename copy_cvref<From>::template apply<To>;
4468 using apply = copy_cvref_t<T1, T2>;
4471 template <
class T1,
class T2,
class T1_RR = remove_reference_t<T1>,
class T2_RR = remove_reference_t<T2>>
4474 template <
class T1,
class T2>
4475 using common_ref_t =
typename common_ref<T1, T2>::type;
4477 template <
class T1,
class T2>
4478 using cv_cond_res = cond_res<copy_cv_t<T1, T2>&, copy_cv_t<T2, T1>&>;
4480 template <
class T1,
class T2,
class T1_RR,
class T2_RR>
4481 requires requires {
typename cv_cond_res<T1_RR, T2_RR>; } && is_reference_v<cv_cond_res<T1_RR, T2_RR>>
4482 struct common_ref<T1&, T2&, T1_RR, T2_RR>
4484 using type = cv_cond_res<T1_RR, T2_RR>;
4487 template <
class T1,
class T2>
4488 using common_ref_rr = remove_reference_t<common_ref_t<T1&, T2&>>&&;
4490 template <
class T1,
class T2,
class T1_R,
class T2_R>
4491 requires requires {
typename common_ref_rr<T1_R, T2_R>; }
4492 && is_convertible_v<T1&&, common_ref_rr<T1_R, T2_R>> && is_convertible_v<T2&&, common_ref_rr<T1_R, T2_R>>
4493 struct common_ref<T1&&, T2&&, T1_R, T2_R>
4495 using type = common_ref_rr<T1_R, T2_R>;
4498 template <
class T1,
class T2>
4499 using common_ref_cr = common_ref_t<const T1&, T2&>;
4501 template <
class T1,
class T2,
class T3,
class T4>
4502 requires requires {
typename common_ref_cr<T3, T4>; } && is_convertible_v<T1&&, common_ref_cr<T3, T4>>
4503 struct common_ref<T1&&, T2&, T3, T4>
4505 using type = common_ref_cr<T3, T4>;
4508 template <
class T1,
class T2,
class T3,
class T4>
4509 struct common_ref<T1&, T2&&, T3, T4> : common_ref<T2&&, T1&>
4513 template <
class T1,
class T2,
class T3,
class T4>
4518 template <
class T1,
class T2>
4519 struct common_reference_impl3;
4521 template <
class T1,
class T2>
4522 struct common_reference_impl2 : common_reference_impl3<T1, T2>
4526 template <
class T1,
class T2>
4527 struct common_reference_impl1 : common_reference_impl2<T1, T2>
4533 template <
class T1,
class T2>
4534 struct common_reference<T1, T2> : private_type_traits::common_reference_impl1<T1, T2>
4538 namespace private_type_traits
4540 template <
class T1,
class T2>
4541 requires is_reference_v<T1> && is_reference_v<T2> &&
requires {
typename common_ref_t<T1, T2>; }
4542 && is_convertible_v<add_pointer_t<T1>, add_pointer_t<common_ref_t<T1, T2>>>
4543 && is_convertible_v<add_pointer_t<T2>, add_pointer_t<common_ref_t<T1, T2>>>
4544 struct common_reference_impl1<T1, T2>
4546 using type = common_ref_t<T1, T2>;
4549 template <
class T1,
class T2>
4550 using basic_common_reference_t =
4551 typename basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>, xref<T1>::template apply, xref<T2>::template apply>::type;
4553 template <
class T1,
class T2>
4554 requires requires {
typename basic_common_reference_t<T1, T2>; }
4555 struct common_reference_impl2<T1, T2>
4557 using type = basic_common_reference_t<T1, T2>;
4560 template <
class T1,
class T2>
4561 requires requires {
typename cond_res<T1, T2>; }
4562 struct common_reference_impl3<T1, T2>
4564 using type = cond_res<T1, T2>;
4567 template <
class T1,
class T2>
4568 struct common_reference_impl3 : common_type<T1, T2>
4573 template <
class T1,
class T2,
class T3,
class... TArgs>
4574 requires requires {
typename common_reference_t<T1, T2>; }
4575 struct common_reference<T1, T2, T3, TArgs...> : common_reference<common_reference_t<T1, T2>, T3, TArgs...>
4579 template <
class... TArgs>
4580 struct common_reference
4587 template <
typename,
typename =
void>
4592 template <
typename T>
4593 struct has_size<T, void_t<decltype(etl::declval<T>().
size())> > : etl::true_type
4597 template <
typename T>
4608 template <
typename U>
4609 static yes test_size(
char (*)[
sizeof(&U::size)]);
4611 template <
typename U>
4612 static no test_size(...);
4616 static const bool value = (
sizeof(test_size<T>(0)) ==
sizeof(yes));
4621 template <
typename,
typename =
void>
4626 template <
typename T>
4627 struct has_data<T, void_t<decltype(etl::declval<T>().
data())> > : etl::true_type
4631 template <
typename T>
4642 template <
typename U>
4643 static yes test_data(
char (*)[
sizeof(&U::data)]);
4645 template <
typename U>
4646 static no test_data(...);
4650 static const bool value = (
sizeof(test_data<T>(0)) ==
sizeof(yes));
4656#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)
4657#define ETL_IS_NOT_CHAR_TYPE(type) (!ETL_IS_CHAR_TYPE(type))
4659#define ETL_IS_POINTER_TYPE(type) (etl::is_pointer<type>::value)
4660#define ETL_IS_NOT_POINTER_TYPE(type) (!ETL_IS_POINTER_TYPE(type))
4662#define ETL_TARGET_IS_TRIVIALLY_COPYABLE(type) (etl::is_trivially_copyable< typename etl::iterator_traits<type>::value_type>::value)
4663#define ETL_TARGET_IS_NOT_TRIVIALLY_COPYABLE(type) (!ETL_TARGET_IS_TRIVIALLY_COPYABLE(type))
ETL_CONSTEXPR TContainer::pointer data(TContainer &container)
Definition iterator.h:1470
integral_constant< bool, false > false_type
integral_constant specialisations
Definition type_traits.h:80
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1434
add_const
Definition type_traits.h:251
add_cv
Definition type_traits.h:338
add_pointer
Definition type_traits.h:200
add_volatile
Definition type_traits.h:307
Definition type_traits.h:97
integral_constant
Definition type_traits.h:67
is_const
Definition type_traits.h:213
is_integral
Definition type_traits.h:364
is_signed
Definition type_traits.h:458
is_volatile
Definition type_traits.h:269
negation
Definition type_traits.h:110
remove_const
Definition type_traits.h:233
remove_cv
Definition type_traits.h:325
remove_cvref
Definition type_traits.h:351
remove_pointer
Definition type_traits.h:147
remove_reference
Definition type_traits.h:122
remove_volatile
Definition type_traits.h:289