NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
type_traits.hpp
浏览该文件的文档.
1#ifndef NEFORCE_CORE_TYPEINFO_TYPE_TRAITS_HPP__
2#define NEFORCE_CORE_TYPEINFO_TYPE_TRAITS_HPP__
3
10
12NEFORCE_BEGIN_NAMESPACE__
13
19
25
35template <typename T, T Value>
37 static constexpr T value = Value;
38
39 using value_type = T;
41
46 constexpr explicit operator value_type() const noexcept { return value; }
47
52 NEFORCE_NODISCARD constexpr value_type operator()() const noexcept { return value; }
53};
54
55
61template <bool Value>
63
66
72template <uint32_t Value>
74
80template <uint64_t Value>
82
83
91template <typename... Types>
92using void_t = void;
93
103template <bool Test, typename T = void>
104struct enable_if {};
105
107template <typename T>
108struct enable_if<true, T> {
109 using type = T;
110};
112
117template <bool Test, typename T = void>
119
120
128template <bool Test, typename T1, typename T2>
130 using type = T1;
131};
132
134template <typename T1, typename T2>
135struct conditional<false, T1, T2> {
136 using type = T2;
137};
139
144template <bool Test, typename T1, typename T2>
145using conditional_t = typename conditional<Test, T1, T2>::type;
146
147
155template <typename T>
156struct negation : bool_constant<!static_cast<bool>(T::value)> {};
157
158#ifdef NEFORCE_STANDARD_14
163template <typename T>
164NEFORCE_INLINE17 constexpr bool negation_v = negation<T>::value;
165#endif
166
167
174template <typename T1, typename T2>
175struct is_same : false_type {};
176
178template <typename T>
179struct is_same<T, T> : true_type {};
181
182#ifdef NEFORCE_STANDARD_14
187template <typename T1, typename T2>
188NEFORCE_INLINE17 constexpr bool is_same_v = is_same<T1, T2>::value;
189#endif
190
191
199template <typename T>
201 using type = T;
202};
203
208template <typename T>
209using type_identity_t = typename type_identity<T>::type;
210
211
218template <typename T, typename... Types>
219struct is_any_of;
220
221#ifdef NEFORCE_STANDARD_17
222template <typename T, typename... Types>
223struct is_any_of : bool_constant<(is_same_v<T, Types> || ...)> {};
224#else
225template <typename T, typename... Types>
226struct is_any_of : false_type {};
227
229template <typename T, typename U>
230struct is_any_of<T, U> : is_same<T, U> {};
231
232template <typename T, typename U, typename... Types>
233struct is_any_of<T, U, Types...> : conditional<is_same<T, U>::value, true_type, is_any_of<T, Types...>>::type {};
235#endif // NEFORCE_STANDARD_17
236
237#ifdef NEFORCE_STANDARD_14
242template <typename T, typename... Types>
243NEFORCE_INLINE17 constexpr bool is_any_of_v = is_any_of<T, Types...>::value;
244#endif
245
246
248NEFORCE_BEGIN_INNER__
249// 析取辅助实现
250template <bool, typename first, typename...>
251struct __disjunction_aux {
252 using type = first;
253};
254template <typename Curr, typename Next, typename... Rest>
255struct __disjunction_aux<false, Curr, Next, Rest...> {
256 using type = typename __disjunction_aux<static_cast<bool>(Next::value), Next, Rest...>::type;
257};
258NEFORCE_END_INNER__
260
268template <typename... Args>
270
272template <typename First, typename... Rest>
273struct disjunction<First, Rest...> : inner::__disjunction_aux<static_cast<bool>(First::value), First, Rest...>::type {};
275
276#ifdef NEFORCE_STANDARD_14
281template <typename... Args>
282NEFORCE_INLINE17 constexpr bool disjunction_v = disjunction<Args...>::value;
283#endif
284
285
287NEFORCE_BEGIN_INNER__
288// 合取辅助实现
289template <bool, typename First, typename...>
290struct __conjunction_aux {
291 using type = First;
292};
293template <typename Curr, typename Next, typename... Rest>
294struct __conjunction_aux<true, Curr, Next, Rest...> {
295 using type = typename __conjunction_aux<static_cast<bool>(Next::value), Next, Rest...>::type;
296};
297NEFORCE_END_INNER__
299
307template <typename... Args>
309
311template <typename First, typename... Rest>
312struct conjunction<First, Rest...> : inner::__conjunction_aux<static_cast<bool>(First::value), First, Rest...>::type {};
314
315#ifdef NEFORCE_STANDARD_14
320template <typename... Args>
321NEFORCE_INLINE17 constexpr bool conjunction_v = conjunction<Args...>::value;
322#endif
323 // TypeTraitsUtilities
325
331
337template <typename T>
339 using type = T;
340};
341
343template <typename T>
344struct remove_const<const T> {
345 using type = T;
346};
348
353template <typename T>
354using remove_const_t = typename remove_const<T>::type;
355
356
362template <typename T>
364 using type = T;
365};
366
368template <typename T>
369struct remove_volatile<volatile T> {
370 using type = T;
371};
373
378template <typename T>
379using remove_volatile_t = typename remove_volatile<T>::type;
380
381
389template <typename T>
390struct remove_cv {
391 using type = T;
392
397 template <typename wrapper>
398 using bind_cv_t = wrapper;
399};
400
402template <typename T>
403struct remove_cv<const T> {
404 using type = T;
405
406 template <typename wrapper>
407 using bind_cv_t = const wrapper;
408};
409
410template <typename T>
411struct remove_cv<volatile T> {
412 using type = T;
413
414 template <typename wrapper>
415 using bind_cv_t = volatile wrapper;
416};
417
418template <typename T>
419struct remove_cv<const volatile T> {
420 using type = T;
421
422 template <typename wrapper>
423 using bind_cv_t = const volatile wrapper;
424};
426
431template <typename T>
432using remove_cv_t = typename remove_cv<T>::type;
433
440template <typename From, typename To>
441using copy_cv_t = typename remove_cv<From>::template bind_cv_t<To>;
442
443
451template <typename T>
453 using type = T;
454
459 template <typename wrapper>
460 using bind_ref_t = wrapper;
461};
462
464template <typename T>
465struct remove_reference<T&> {
466 using type = T;
467
468 template <typename wrapper>
469 using bind_ref_t = wrapper&;
470};
471
472template <typename T>
473struct remove_reference<T&&> {
474 using type = T;
475
476 template <typename wrapper>
477 using bind_ref_t = wrapper&&;
478};
480
485template <typename T>
486using remove_reference_t = typename remove_reference<T>::type;
487
494template <typename From, typename To>
496
503template <typename From, typename To>
505
506
512template <typename T>
515};
516
521template <typename T>
522using remove_cvref_t = typename remove_cvref<T>::type;
523
524
530template <typename T>
532 using type = T;
533};
534
536template <typename T, size_t Idx>
537struct remove_extent<T[Idx]> {
538 using type = T;
539};
540
541template <typename T>
542struct remove_extent<T[]> {
543 using type = T;
544};
546
551template <typename T>
552using remove_extent_t = typename remove_extent<T>::type;
553
554
560template <typename T>
562 using type = T;
563};
564
566template <typename T, size_t Idx>
567struct remove_all_extents<T[Idx]> {
568 using type = typename remove_all_extents<T>::type;
569};
570
571template <typename T>
572struct remove_all_extents<T[]> {
573 using type = typename remove_all_extents<T>::type;
574};
576
581template <typename T>
582using remove_all_extents_t = typename remove_all_extents<T>::type;
583
584
592template <typename T>
594 using type = T;
595
600 template <typename wrapper>
601 using bind_pointer_t = wrapper;
602};
603
605template <typename T>
606struct remove_pointer<T*> {
607 using type = T;
608
609 template <typename wrapper>
610 using bind_pointer_t = wrapper*;
611};
612
613template <typename T>
614struct remove_pointer<T* const> {
615 using type = T;
616
617 template <typename wrapper>
618 using bind_pointer_t = const wrapper*;
619};
620
621template <typename T>
622struct remove_pointer<T* volatile> {
623 using type = T;
624
625 template <typename wrapper>
626 using bind_pointer_t = volatile wrapper*;
627};
628
629template <typename T>
630struct remove_pointer<T* const volatile> {
631 using type = T;
632
633 template <typename wrapper>
634 using bind_pointer_t = volatile const wrapper*;
635};
637
642template <typename T>
643using remove_pointer_t = typename remove_pointer<T>::type;
644
651template <typename From, typename To>
653
654
660template <typename T>
662 using type = T;
663};
664
666
667template <typename Ret, typename... Args>
668struct remove_function_qualifiers<Ret(Args...)> {
669 using type = Ret(Args...);
670};
671
672#define __NEFORCE_EXPAND_REM_FUNC_QULF(QUF) \
673 template <typename Ret, typename... Args> \
674 struct remove_function_qualifiers<Ret(Args...) QUF> { \
675 using type = Ret(Args...); \
676 };
677
678NEFORCE_MACRO_RANGES_CV(__NEFORCE_EXPAND_REM_FUNC_QULF)
679NEFORCE_MACRO_RANGES_CV_REF(__NEFORCE_EXPAND_REM_FUNC_QULF)
680#ifdef NEFORCE_STANDARD_17
681NEFORCE_MACRO_RANGES_CV_REF_NOEXCEPT(__NEFORCE_EXPAND_REM_FUNC_QULF)
682#endif
683#undef __NEFORCE_EXPAND_REM_FUNC_QULF
684
686
691template <typename T>
692using remove_function_qualifiers_t = typename remove_function_qualifiers<T>::type;
693 // RemoveQualifiers
695
701
703NEFORCE_BEGIN_INNER__
704template <typename>
705struct __is_void_helper : false_type {};
706
707template <>
708struct __is_void_helper<void> : true_type {};
709NEFORCE_END_INNER__
711
719template <typename T>
720struct is_void : inner::__is_void_helper<remove_cv_t<T>>::type {};
721
722#ifdef NEFORCE_STANDARD_14
727template <typename T>
728NEFORCE_INLINE17 constexpr bool is_void_v = is_void<T>::value;
729#endif
730
731
738template <typename T, typename Dummy = void>
739struct package {
740 using type = T;
741};
742
747template <typename T>
748using package_t = typename package<T>::type;
749
755template <typename T>
756struct is_packaged : bool_constant<!is_same<package_t<T>, T>::value> {};
757
758#ifdef NEFORCE_STANDARD_14
763template <typename T>
764NEFORCE_INLINE17 constexpr bool is_packaged_v = is_packaged<T>::value;
765#endif
766
773template <typename T, typename Dummy = void>
774struct unpackage {
775 using type = T;
776};
777
782template <typename T>
783using unpackage_t = typename unpackage<T>::type;
784
789template <typename T>
791
797template <typename T>
798struct is_unpackaged : bool_constant<!is_same<unpackage_t<T>, T>::value> {};
799
800#ifdef NEFORCE_STANDARD_14
805template <typename T>
806NEFORCE_INLINE17 constexpr bool is_unpackaged_v = is_unpackaged<T>::value;
807#endif
808
809
815template <typename T>
816struct is_character : bool_constant<is_any_of<remove_cvref_t<T>, char, wchar_t,
817#ifdef NEFORCE_STANDARD_20
818 char8_t,
819#endif
820 char16_t, char32_t>::value> {
821};
822
823#ifdef NEFORCE_STANDARD_14
828template <typename T>
829NEFORCE_INLINE17 constexpr bool is_character_v = is_character<T>::value;
830#endif
831
832
838template <typename T>
839struct is_boolean : bool_constant<is_same<remove_cvref_t<T>, bool>::value> {};
840
841#ifdef NEFORCE_STANDARD_14
846template <typename T>
847NEFORCE_INLINE17 constexpr bool is_boolean_v = is_boolean<T>::value;
848#endif
849
850
858template <typename T>
860: bool_constant<is_any_of<remove_cvref_t<T>, signed char, short, int, long, long long, unsigned char, unsigned short,
861 unsigned int, unsigned long, unsigned long long>::value> {};
862
863#ifdef NEFORCE_STANDARD_14
868template <typename T>
870#endif
871
872
880template <typename T>
881struct is_integral : bool_constant<disjunction<is_standard_integral<T>, is_character<T>, is_boolean<T>>::value> {};
882
883#ifdef NEFORCE_STANDARD_14
888template <typename T>
889NEFORCE_INLINE17 constexpr bool is_integral_v = is_integral<T>::value;
890#endif
891
892
898template <typename T>
899struct is_floating_point : bool_constant<is_any_of<remove_cvref_t<T>, float, double, long double>::value> {};
900
901#ifdef NEFORCE_STANDARD_14
906template <typename T>
907NEFORCE_INLINE17 constexpr bool is_floating_point_v = is_floating_point<T>::value;
908#endif
909
910
918template <typename T>
919struct is_arithmetic : bool_constant<disjunction<is_integral<T>, is_floating_point<T>>::value> {};
920
921#ifdef NEFORCE_STANDARD_14
926template <typename T>
927NEFORCE_INLINE17 constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
928#endif
929
930
932NEFORCE_BEGIN_INNER__
933template <typename T, bool = is_integral<T>::value>
934struct __check_sign_aux {
935 static constexpr bool is_signed = static_cast<remove_cvref_t<T>>(-1) < static_cast<remove_cv_t<T>>(0);
936 static constexpr bool is_unsigned = !is_signed;
937};
938
939template <typename T>
940struct __check_sign_aux<T, false> {
941 static constexpr bool is_signed = is_floating_point<T>::value;
942 static constexpr bool is_unsigned = false;
943};
944NEFORCE_END_INNER__
946
952template <typename T>
953struct is_signed : bool_constant<inner::__check_sign_aux<unpack_remove_cvref_t<T>>::is_signed> {};
954
955#ifdef NEFORCE_STANDARD_14
960template <typename T>
961NEFORCE_INLINE17 constexpr bool is_signed_v = is_signed<T>::value;
962#endif
963
969template <typename T>
970struct is_unsigned : bool_constant<inner::__check_sign_aux<unpack_remove_cvref_t<T>>::is_unsigned> {};
971
972#ifdef NEFORCE_STANDARD_14
977template <typename T>
978NEFORCE_INLINE17 constexpr bool is_unsigned_v = is_unsigned<T>::value;
979#endif
980 // TypeProperties
982
988
994template <typename T>
995struct add_const {
996 using type = const T;
997};
998
1003template <typename T>
1004using add_const_t = typename add_const<T>::type;
1005
1013template <typename T>
1014NEFORCE_NODISCARD constexpr add_const_t<T>& as_const(T& val) noexcept {
1015 return val;
1016}
1017
1019template <typename T>
1020void as_const(const T&&) = delete;
1022
1028template <typename T>
1030 using type = volatile T;
1031};
1032
1037template <typename T>
1038using add_volatile_t = typename add_volatile<T>::type;
1039
1045template <typename T>
1046struct add_cv {
1047 using type = const volatile T;
1048};
1049
1054template <typename T>
1055using add_cv_t = typename add_cv<T>::type;
1056
1057
1066template <typename T, typename Dummy = void>
1068 using lvalue = T;
1069 using rvalue = T;
1070};
1071
1073template <typename T>
1074struct add_reference<T, void_t<T&>> {
1075 using lvalue = T&;
1076 using rvalue = T&&;
1077};
1079
1085template <typename T>
1087 using type = typename add_reference<T>::lvalue;
1088};
1089
1094template <typename T>
1095using add_lvalue_reference_t = typename add_reference<T>::lvalue;
1096
1102template <typename T>
1104 using type = typename add_reference<T>::rvalue;
1105};
1106
1111template <typename T>
1112using add_rvalue_reference_t = typename add_reference<T>::rvalue;
1113
1114
1121template <typename T, typename Dummy = void>
1123 using type = T;
1124};
1125
1127template <typename T>
1128struct add_pointer<T, void_t<remove_reference_t<T>*>> {
1129 using type = remove_reference_t<T>*;
1130};
1132
1137template <typename T>
1138using add_pointer_t = typename add_pointer<T>::type;
1139 // AddQualifiers
1141
1147
1154template <typename T>
1156
1157template <typename T>
1158add_lvalue_reference_t<T> ldeclval() noexcept;
1159
1166template <typename T>
1168
1174template <typename T>
1175void declvoid(type_identity_t<T>) noexcept;
1176 // DeclvalTools
1178
1184
1192template <typename T>
1193struct rank : integral_constant<size_t, 0> {};
1194
1196template <typename T, size_t Idx>
1197struct rank<T[Idx]> : integral_constant<size_t, rank<T>::value + 1> {};
1198
1199template <typename T>
1200struct rank<T[]> : integral_constant<size_t, rank<T>::value + 1> {};
1202
1203#ifdef NEFORCE_STANDARD_14
1208template <typename T>
1209NEFORCE_INLINE17 constexpr size_t rank_v = rank<T>::value;
1210#endif
1211
1212
1221template <typename T, uint32_t Idx = 0>
1222struct extent : integral_constant<size_t, 0> {};
1223
1225template <typename T, size_t N>
1226struct extent<T[N], 0> : integral_constant<size_t, N> {};
1227
1228template <typename T, uint32_t Idx, size_t N>
1229struct extent<T[N], Idx> : extent<T, Idx - 1> {};
1230
1231template <typename T, uint32_t Idx>
1232struct extent<T[], Idx> : extent<T, Idx - 1> {};
1234
1235#ifdef NEFORCE_STANDARD_14
1240template <typename T, uint32_t Idx = 0>
1241NEFORCE_INLINE17 constexpr size_t extent_v = extent<T, Idx>::value;
1242#endif
1243 // ArrayProperties
1245
1251
1257template <typename T>
1259
1261template <template <typename, typename...> class T, typename First, typename... Rest>
1262struct get_first_temp_para<T<First, Rest...>> {
1263 using type = First;
1264};
1266
1271template <typename Tmp>
1273
1274
1280template <typename... Types>
1282
1284template <typename First, typename... Rest>
1285struct get_first_para<First, Rest...> {
1286 using type = First;
1287};
1289
1294template <typename... Types>
1295using get_first_para_t = typename get_first_para<Types...>::type;
1296
1297
1306template <typename T, typename Dummy = void>
1308 using type = ptrdiff_t;
1309};
1310
1312template <typename T>
1313struct get_ptr_difference<T, enable_if_t<is_same<typename T::difference_type, typename T::difference_type>::value>> {
1314 using type = typename T::difference_type;
1315};
1317
1322template <typename T>
1323using get_ptr_difference_t = typename get_ptr_difference<T>::type;
1324
1325
1332template <typename NewFirst, typename T>
1334
1336template <typename NewFirst, template <typename, typename...> class T, typename First, typename... Rest>
1337struct replace_first_para<NewFirst, T<First, Rest...>> {
1338 using type = T<NewFirst, Rest...>;
1339};
1341
1346template <typename T, typename U>
1348
1349
1359template <typename T, typename U, typename Dummy = void>
1361 using type = replace_first_para_t<U, T>;
1362};
1363
1365template <typename T, typename U>
1366struct get_rebind_type<T, U,
1367 enable_if_t<is_same<typename T::template rebind<U>, typename T::template rebind<U>>::value>> {
1368 using type = typename T::template rebind<U>;
1369};
1371
1376template <typename T, typename U>
1377using get_rebind_type_t = typename get_rebind_type<T, U>::type;
1378 // TemplateTraitsUtilities
1380
1386
1392template <typename T>
1394
1396template <typename T, size_t Idx>
1397struct is_bounded_array<T[Idx]> : true_type {};
1399
1400#ifdef NEFORCE_STANDARD_14
1405template <typename T>
1406NEFORCE_INLINE17 constexpr bool is_bounded_array_v = is_bounded_array<T>::value;
1407#endif
1408
1409
1415template <typename T>
1417
1419template <typename T>
1420struct is_unbounded_array<T[]> : true_type {};
1422
1423#ifdef NEFORCE_STANDARD_14
1428template <typename T>
1429NEFORCE_INLINE17 constexpr bool is_unbounded_array_v = is_unbounded_array<T>::value;
1430#endif
1431
1439template <typename T>
1440struct is_array : bool_constant<is_unbounded_array<T>::value || is_bounded_array<T>::value> {};
1441
1442#ifdef NEFORCE_STANDARD_14
1447template <typename T>
1448NEFORCE_INLINE17 constexpr bool is_array_v = is_array<T>::value;
1449#endif
1450
1451
1457template <typename T>
1459
1461template <typename T>
1462struct is_lvalue_reference<T&> : true_type {};
1464
1465#ifdef NEFORCE_STANDARD_14
1470template <typename T>
1472#endif
1473
1479template <typename T>
1481
1483template <typename T>
1484struct is_rvalue_reference<T&&> : true_type {};
1486
1487#ifdef NEFORCE_STANDARD_14
1492template <typename T>
1494#endif
1495
1496
1504template <typename T>
1505struct is_reference : bool_constant<is_lvalue_reference<T>::value || is_rvalue_reference<T>::value> {};
1506
1507#ifdef NEFORCE_STANDARD_14
1512template <typename T>
1513NEFORCE_INLINE17 constexpr bool is_reference_v = is_reference<T>::value;
1514#endif
1515
1516
1522template <typename T>
1523struct is_null_pointer : bool_constant<is_same<remove_cvref_t<T>, nullptr_t>::value> {};
1524
1525#ifdef NEFORCE_STANDARD_14
1530template <typename T>
1531NEFORCE_INLINE17 constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
1532#endif
1533
1534
1542template <typename T>
1544
1546template <typename T>
1547struct is_pointer<T*> : true_type {};
1548
1549template <typename T>
1550struct is_pointer<T* const> : true_type {};
1551
1552template <typename T>
1553struct is_pointer<T* volatile> : true_type {};
1554
1555template <typename T>
1556struct is_pointer<T* const volatile> : true_type {};
1558
1559#ifdef NEFORCE_STANDARD_14
1564template <typename T>
1565NEFORCE_INLINE17 constexpr bool is_pointer_v = is_pointer<T>::value;
1566#endif
1567
1568
1574template <typename T>
1575struct is_enum : bool_constant<__is_enum(T)> {};
1576
1577#ifdef NEFORCE_STANDARD_14
1582template <typename T>
1583NEFORCE_INLINE17 constexpr bool is_enum_v = is_enum<T>::value;
1584#endif
1585
1586
1594template <typename T>
1595struct is_integral_like : bool_constant<disjunction<is_integral<T>, is_enum<T>>::value> {};
1596
1597#ifdef NEFORCE_STANDARD_14
1602template <typename T>
1603NEFORCE_INLINE17 constexpr bool is_integral_like_v = is_integral_like<T>::value;
1604#endif
1605
1606
1612template <typename T>
1613struct is_union : bool_constant<__is_union(T)> {};
1614
1615#ifdef NEFORCE_STANDARD_14
1620template <typename T>
1621NEFORCE_INLINE17 constexpr bool is_union_v = is_union<T>::value;
1622#endif
1623
1624
1630template <typename T>
1631struct is_class : bool_constant<__is_class(T)> {};
1632
1633#ifdef NEFORCE_STANDARD_14
1638template <typename T>
1639NEFORCE_INLINE17 constexpr bool is_class_v = is_class<T>::value;
1640#endif
1641
1642
1650template <typename T>
1651struct is_fundamental : bool_constant<disjunction<is_arithmetic<T>, is_void<T>, is_null_pointer<T>>::value> {};
1652
1653#ifdef NEFORCE_STANDARD_14
1658template <typename T>
1659NEFORCE_INLINE17 constexpr bool is_fundamental_v = is_fundamental<T>::value;
1660#endif
1661
1662
1670template <typename T>
1671struct is_compound : bool_constant<!is_fundamental<T>::value> {};
1672
1673#ifdef NEFORCE_STANDARD_14
1678template <typename T>
1679NEFORCE_INLINE17 constexpr bool is_compound_v = is_compound<T>::value;
1680#endif
1681
1682
1688template <typename T>
1690
1692template <typename T>
1693struct is_const<const T> : true_type {};
1695
1696#ifdef NEFORCE_STANDARD_14
1701template <typename T>
1702NEFORCE_INLINE17 constexpr bool is_const_v = is_const<T>::value;
1703#endif
1704
1705
1711template <typename T>
1713
1715template <typename T>
1716struct is_volatile<volatile T> : true_type {};
1718
1719#ifdef NEFORCE_STANDARD_14
1724template <typename T>
1725NEFORCE_INLINE17 constexpr bool is_volatile_v = is_volatile<T>::value;
1726#endif
1727
1728
1729#ifdef NEFORCE_COMPILER_MSVC
1730// 禁用MSVC警告4180:从const限定的函数类型中移除const
1731# pragma warning(push)
1732# pragma warning(disable : 4180)
1733#endif
1734
1743template <typename T>
1744struct is_function : bool_constant<!is_const<const remove_function_qualifiers_t<T>>::value &&
1745 !is_reference<remove_function_qualifiers_t<T>>::value> {};
1746
1747#ifdef NEFORCE_STANDARD_14
1752template <typename T>
1753NEFORCE_INLINE17 constexpr bool is_function_v = is_function<T>::value;
1754#endif
1755
1756#ifdef NEFORCE_COMPILER_MSVC
1757# pragma warning(pop)
1758#endif
1759
1760
1773template <typename T>
1775: bool_constant<!(is_void<T>::value || is_reference<T>::value || is_function<T>::value || is_const<T>::value) &&
1776 (sizeof(T) > 0)> {};
1777
1778#ifdef NEFORCE_STANDARD_14
1783template <typename T>
1784NEFORCE_INLINE17 constexpr bool is_allocable_v = is_allocable<T>::value;
1785#endif
1786
1787
1796template <typename T>
1797struct is_object : bool_constant<is_const<const T>::value && !is_void<T>::value> {};
1798
1799#ifdef NEFORCE_STANDARD_14
1804template <typename T>
1805NEFORCE_INLINE17 constexpr bool is_object_v = is_object<T>::value;
1806#endif
1807
1808
1818template <typename T>
1820: bool_constant<(is_pointer<remove_cvref_t<T>>::value && is_character<remove_pointer_t<remove_cvref_t<T>>>::value) ||
1821 (is_bounded_array<remove_cvref_t<T>>::value &&
1822 is_character<remove_all_extents_t<remove_cvref_t<T>>>::value)> {};
1823
1824#ifdef NEFORCE_STANDARD_14
1829template <typename T>
1831#endif
1832
1833
1839template <typename T>
1841
1843#ifdef NEFORCE_COMPILER_CLANG
1844template <typename T>
1845struct is_member_function_pointer : bool_constant<__is_member_function_pointer(T)> {};
1846#else
1847NEFORCE_BEGIN_INNER__
1848template <typename>
1849struct __is_member_function_pointer_aux : false_type {};
1850template <typename T, typename C>
1851struct __is_member_function_pointer_aux<T C::*> : is_function<T> {};
1852NEFORCE_END_INNER__
1853
1854template <typename T>
1855struct is_member_function_pointer : inner::__is_member_function_pointer_aux<remove_cv_t<T>> {};
1856#endif
1858
1859#ifdef NEFORCE_STANDARD_14
1864template <typename T>
1866#endif
1867
1868
1874template <typename T>
1876
1878#ifdef NEFORCE_COMPILER_CLANG
1879template <typename T>
1880struct is_member_object_pointer : bool_constant<__is_member_object_pointer(T)> {};
1881#else
1882template <typename T>
1884template <typename T, typename C>
1885struct is_member_object_pointer<T C::*> : bool_constant<!is_function<T>::value> {};
1886#endif
1888
1889#ifdef NEFORCE_STANDARD_14
1894template <typename T>
1896#endif
1897
1898
1904template <typename T>
1906
1908#ifdef NEFORCE_COMPILER_CLANG
1909template <typename T>
1910struct is_member_pointer : bool_constant<__is_member_pointer(T)> {};
1911#else
1912template <typename T>
1913struct is_member_pointer : bool_constant<is_member_object_pointer<T>::value || is_member_function_pointer<T>::value> {};
1914#endif
1916
1917#ifdef NEFORCE_STANDARD_14
1922template <typename T>
1923NEFORCE_INLINE17 constexpr bool is_member_pointer_v = is_member_pointer<T>::value;
1924#endif
1925
1926
1939template <typename T>
1942 disjunction<is_arithmetic<T>, is_enum<T>, is_pointer<T>, is_member_pointer<T>, is_null_pointer<T>>::value> {};
1943
1944#ifdef NEFORCE_STANDARD_14
1949template <typename T>
1950NEFORCE_INLINE17 constexpr bool is_scalar_v = is_scalar<T>::value;
1951#endif
1952
1953
1964template <typename T>
1965struct is_empty : bool_constant<__is_empty(T)> {};
1966
1967#ifdef NEFORCE_STANDARD_14
1972template <typename T>
1973NEFORCE_INLINE17 constexpr bool is_empty_v = is_empty<T>::value;
1974#endif
1975
1976
1984template <typename T>
1985struct is_polymorphic : bool_constant<__is_polymorphic(T)> {};
1986
1987#ifdef NEFORCE_STANDARD_14
1992template <typename T>
1993NEFORCE_INLINE17 constexpr bool is_polymorphic_v = is_polymorphic<T>::value;
1994#endif
1995
1996
2004template <typename T>
2005struct is_abstract : bool_constant<__is_abstract(T)> {};
2006
2007#ifdef NEFORCE_STANDARD_14
2012template <typename T>
2013NEFORCE_INLINE17 constexpr bool is_abstract_v = is_abstract<T>::value;
2014#endif
2015
2016
2024template <typename T>
2025struct is_final : bool_constant<__is_final(T)> {};
2026
2027#ifdef NEFORCE_STANDARD_14
2032template <typename T>
2033NEFORCE_INLINE17 constexpr bool is_final_v = is_final<T>::value;
2034#endif
2035
2036
2038NEFORCE_BEGIN_INNER__
2039template <typename T, bool = is_enum<T>::value>
2040struct __underlying_type_aux {
2041 using type = __underlying_type(T);
2042};
2043template <typename T>
2044struct __underlying_type_aux<T, false> {};
2045NEFORCE_END_INNER__
2047
2055template <typename T>
2056struct underlying_type : inner::__underlying_type_aux<T> {};
2057
2062template <typename T>
2064
2065
2077template <typename T>
2078struct is_standard_layout : bool_constant<__is_standard_layout(T)> {};
2079
2080#ifdef NEFORCE_STANDARD_14
2085template <typename T>
2086NEFORCE_INLINE17 constexpr bool is_standard_layout_v = is_standard_layout<T>::value;
2087#endif
2088
2089
2097template <typename T>
2098struct is_pod : bool_constant<__is_pod(T)> {};
2099
2100#ifdef NEFORCE_STANDARD_14
2105template <typename T>
2106NEFORCE_INLINE17 constexpr bool is_pod_v = is_pod<T>::value;
2107#endif
2108
2109
2122template <typename T>
2123struct has_unique_object_representations : bool_constant<__has_unique_object_representations(T)> {};
2124
2125#ifdef NEFORCE_STANDARD_14
2130template <typename T>
2132#endif
2133
2134
2147template <typename T>
2149
2151#ifdef NEFORCE_COMPILER_MSVC
2152template <typename T>
2153struct is_aggregate : bool_constant<is_array<T>::value || __is_aggregate(T)> {};
2154#else
2155template <typename T>
2156struct is_aggregate : bool_constant<__is_aggregate(remove_cv_t<T>)> {};
2157#endif
2159
2160#ifdef NEFORCE_STANDARD_14
2165template <typename T>
2166NEFORCE_INLINE17 constexpr bool is_aggregate_v = is_aggregate<T>::value;
2167#endif
2168
2169
2170#ifdef NEFORCE_COMPILER_MSVC
2181template <typename T1, typename T2>
2182struct is_layout_compatible : bool_constant<__is_layout_compatible(T1, T2)> {};
2183
2188# ifdef NEFORCE_STANDARD_14
2189template <typename T1, typename T2>
2190NEFORCE_INLINE17 constexpr bool is_layout_compatible_v = is_layout_compatible<T1, T2>::value;
2191# endif
2192
2193
2202template <typename Base, typename Derived>
2203struct is_pointer_interconvertible_base_of : bool_constant<__is_pointer_interconvertible_base_of(Base, Derived)> {};
2204
2205# ifdef NEFORCE_STANDARD_14
2210template <typename Base, typename Derived>
2211NEFORCE_INLINE17 constexpr bool is_pointer_interconvertible_base_of_v =
2212 is_pointer_interconvertible_base_of<Base, Derived>::value;
2213# endif
2214#endif
2215
2216
2223template <typename Base, typename Derived>
2224struct is_base_of : bool_constant<__is_base_of(Base, Derived)> {};
2225
2226#ifdef NEFORCE_STANDARD_14
2231template <typename Base, typename Derived>
2232NEFORCE_INLINE17 constexpr bool is_base_of_v = is_base_of<Base, Derived>::value;
2233#endif
2234
2235
2236#ifdef NEFORCE_STANDARD_20
2246template <typename T, typename Mem>
2247constexpr bool is_pointer_interconvertible_with_class(Mem T::* mp) noexcept {
2248 return __builtin_is_pointer_interconvertible_with_class(mp);
2249}
2250
2263template <typename S1, typename S2, typename M1, typename M2>
2264constexpr bool is_corresponding_member(M1 S1::* m1, M2 S2::* m2) noexcept {
2265 return __builtin_is_corresponding_member(m1, m2);
2266}
2267#endif
2268 // BaseTypeQualifierCheck
2270
2276
2287template <typename T>
2288struct is_trivial : bool_constant<__is_trivial(T)> {};
2289
2290#ifdef NEFORCE_STANDARD_14
2295template <typename T>
2296NEFORCE_INLINE17 constexpr bool is_trivial_v = is_trivial<T>::value;
2297#endif
2298
2299
2307template <typename T>
2308struct is_trivially_copyable : bool_constant<__is_trivially_copyable(T)> {};
2309
2310#ifdef NEFORCE_STANDARD_14
2315template <typename T>
2317#endif
2318
2319
2325template <typename T>
2326struct has_virtual_destructor : bool_constant<__has_virtual_destructor(T)> {};
2327
2328#ifdef NEFORCE_STANDARD_14
2333template <typename T>
2335#endif
2336
2337
2344template <typename T, typename... Args>
2345struct is_constructible : bool_constant<__is_constructible(T, Args...)> {};
2346
2347#ifdef NEFORCE_STANDARD_14
2352template <typename T, typename... Args>
2353NEFORCE_INLINE17 constexpr bool is_constructible_v = is_constructible<T, Args...>::value;
2354#endif
2355
2356
2362template <typename T>
2363struct is_copy_constructible : bool_constant<is_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2364
2365#ifdef NEFORCE_STANDARD_14
2370template <typename T>
2372#endif
2373
2374
2380template <typename T>
2381struct is_default_constructible : bool_constant<is_constructible<T>::value> {};
2382
2383#ifdef NEFORCE_STANDARD_14
2388template <typename T>
2390#endif
2391
2392
2394NEFORCE_BEGIN_INNER__
2395template <typename T>
2396void __implicitly_default_construct_aux(const T&) noexcept;
2397NEFORCE_END_INNER__
2399
2408template <typename T, typename Dummy = void>
2410
2412template <typename T>
2413struct is_implicitly_default_constructible<T, void_t<decltype(inner::__implicitly_default_construct_aux<T>({}))>>
2414: true_type {};
2416
2417#ifdef NEFORCE_STANDARD_14
2422template <typename T>
2424#endif
2425
2426
2432template <typename T>
2433struct is_move_constructible : bool_constant<is_constructible<T, T>::value> {};
2434
2435#ifdef NEFORCE_STANDARD_14
2440template <typename T>
2442#endif
2443
2444
2451template <typename To, typename From>
2452struct is_assignable : bool_constant<__is_assignable(To, From)> {};
2453
2454#ifdef NEFORCE_STANDARD_14
2459template <typename To, typename From>
2460NEFORCE_INLINE17 constexpr bool is_assignable_v = is_assignable<To, From>::value;
2461#endif
2462
2463
2471template <typename T>
2473: bool_constant<is_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2474
2475#ifdef NEFORCE_STANDARD_14
2480template <typename T>
2481NEFORCE_INLINE17 constexpr bool is_copy_assignable_v = is_copy_assignable<T>::value;
2482#endif
2483
2484
2492template <typename T>
2493struct is_move_assignable : bool_constant<is_assignable<add_lvalue_reference_t<T>, T>::value> {};
2494
2495#ifdef NEFORCE_STANDARD_14
2500template <typename T>
2501NEFORCE_INLINE17 constexpr bool is_move_assignable_v = is_move_assignable<T>::value;
2502#endif
2503
2504
2515template <typename T>
2517
2519#ifdef NEFORCE_COMPILER_MSVC
2520template <typename T>
2521struct is_destructible : bool_constant<__is_destructible(T)> {};
2522#else
2523NEFORCE_BEGIN_INNER__
2524template <typename T>
2525struct __destructible_aux {
2526private:
2527 template <typename T1, typename = decltype(declval<T1&>().~T1())>
2528 static true_type __test(int);
2529 template <typename>
2530 static false_type __test(...);
2531
2532public:
2533 using type = decltype(__test<T>(0));
2534};
2535
2536template <typename T, bool = disjunction<is_void<T>, is_unbounded_array<T>, is_function<T>>::value,
2537 bool = disjunction<is_reference<T>, is_scalar<T>>::value>
2538struct __is_destructible_dispatch;
2539
2540template <typename T>
2541struct __is_destructible_dispatch<T, false, false> : __destructible_aux<remove_all_extents_t<T>>::type {};
2542
2543template <typename T>
2544struct __is_destructible_dispatch<T, true, false> : false_type {};
2545
2546template <typename T>
2547struct __is_destructible_dispatch<T, false, true> : true_type {};
2548
2549NEFORCE_END_INNER__
2550
2551template <typename T>
2552struct is_destructible : inner::__is_destructible_dispatch<T>::type {};
2553#endif
2555
2556#ifdef NEFORCE_STANDARD_14
2561template <typename T>
2562NEFORCE_INLINE17 constexpr bool is_destructible_v = is_destructible<T>::value;
2563#endif
2564
2565
2574template <typename T, typename... Args>
2575struct is_trivially_constructible : bool_constant<__is_trivially_constructible(T, Args...)> {};
2576
2577#ifdef NEFORCE_STANDARD_14
2582template <typename T, typename... Args>
2583NEFORCE_INLINE17 constexpr bool is_trivially_constructible_v = is_trivially_constructible<T, Args...>::value;
2584#endif
2585
2586
2592template <typename T>
2594: bool_constant<is_trivially_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2595
2596#ifdef NEFORCE_STANDARD_14
2601template <typename T>
2603#endif
2604
2605
2611template <typename T>
2612struct is_trivially_default_constructible : bool_constant<is_trivially_constructible<T>::value> {};
2613
2614#ifdef NEFORCE_STANDARD_14
2619template <typename T>
2621#endif
2622
2623
2629template <typename T>
2630struct is_trivially_move_constructible : bool_constant<is_trivially_constructible<T, T>::value> {};
2631
2632#ifdef NEFORCE_STANDARD_14
2637template <typename T>
2639#endif
2640
2641
2648template <typename To, typename From>
2649struct is_trivially_assignable : bool_constant<__is_trivially_assignable(To, From)> {};
2650
2651#ifdef NEFORCE_STANDARD_14
2656template <typename To, typename From>
2658#endif
2659
2660
2666template <typename T>
2668: bool_constant<is_trivially_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2669
2670#ifdef NEFORCE_STANDARD_14
2675template <typename T>
2677#endif
2678
2679
2685template <typename T>
2686struct is_trivially_move_assignable : bool_constant<is_trivially_assignable<add_lvalue_reference_t<T>, T>::value> {};
2687
2688#ifdef NEFORCE_STANDARD_14
2693template <typename T>
2695#endif
2696
2697
2705template <typename T>
2707#if defined(NEFORCE_COMPILER_MSVC) || defined(NEFORCE_COMPILER_CLANG)
2708 bool_constant<__is_trivially_destructible(T)> {
2709};
2710#else
2711 conjunction<is_destructible<T>, bool_constant<__has_trivial_destructor(T)>> {
2712};
2713#endif
2714
2715#ifdef NEFORCE_STANDARD_14
2720template <typename T>
2722#endif
2723
2724
2731template <typename T, typename... Args>
2733
2739template <typename T>
2741
2743#ifdef NEFORCE_COMPILER_MSVC
2744template <typename T, typename... Args>
2745struct is_nothrow_constructible : bool_constant<__is_nothrow_constructible(T, Args...)> {};
2746#else
2747NEFORCE_BEGIN_INNER__
2748template <typename T, bool = is_array<T>::value>
2749struct __is_nothrow_default_constructible_dispatch;
2750
2751template <typename T>
2752struct __is_nothrow_default_constructible_dispatch<T, true>
2753: conjunction<is_bounded_array<T>, bool_constant<noexcept(remove_all_extents_t<T>())>> {};
2754
2755template <typename T>
2756struct __is_nothrow_default_constructible_dispatch<T, false> : bool_constant<noexcept(T())> {};
2757
2758NEFORCE_END_INNER__
2759
2760template <typename T>
2762: conjunction<is_default_constructible<T>, inner::__is_nothrow_default_constructible_dispatch<T>> {};
2763
2764NEFORCE_BEGIN_INNER__
2765
2766template <typename T, typename... Args>
2767struct __is_nothrow_constructible_dispatch : bool_constant<noexcept(T(_NEFORCE declval<Args>()...))> {};
2768
2769template <typename T>
2770struct __is_nothrow_constructible_dispatch<T> : is_nothrow_default_constructible<T> {};
2771
2772NEFORCE_END_INNER__
2773
2774template <typename T, typename... Args>
2776: conjunction<is_constructible<T, Args...>, inner::__is_nothrow_constructible_dispatch<T, Args...>> {};
2777#endif
2779
2780#ifdef NEFORCE_STANDARD_14
2785template <typename T, typename... Args>
2786NEFORCE_INLINE17 constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<T, Args...>::value;
2787#endif
2788
2789
2795template <typename T>
2797: bool_constant<is_nothrow_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2798
2799#ifdef NEFORCE_STANDARD_14
2804template <typename T>
2806#endif
2807
2808
2810#ifdef NEFORCE_COMPILER_MSVC
2811template <typename T>
2812struct is_nothrow_default_constructible : bool_constant<is_nothrow_constructible_v<T>> {};
2813#endif
2815
2816
2817#ifdef NEFORCE_STANDARD_14
2822template <typename T>
2824#endif
2825
2826
2832template <typename T>
2833struct is_nothrow_move_constructible : bool_constant<is_nothrow_constructible<T, T>::value> {};
2834
2835#ifdef NEFORCE_STANDARD_14
2840template <typename T>
2842#endif
2843
2844
2851template <typename To, typename From>
2853
2855template <typename To, typename From>
2856struct is_nothrow_assignable : bool_constant<__is_nothrow_assignable(To, From)> {};
2858
2859#ifdef NEFORCE_STANDARD_14
2864template <typename To, typename From>
2866#endif
2867
2868
2874template <typename T>
2876: bool_constant<is_nothrow_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2877
2878#ifdef NEFORCE_STANDARD_14
2883template <typename T>
2885#endif
2886
2887
2893template <typename T>
2894struct is_nothrow_move_assignable : bool_constant<is_nothrow_assignable<add_lvalue_reference_t<T>, T>::value> {};
2895
2896#ifdef NEFORCE_STANDARD_14
2901template <typename T>
2903#endif
2904
2905
2906#ifndef NEFORCE_COMPILER_MSVC
2908NEFORCE_BEGIN_INNER__
2909template <typename T>
2910struct __is_nothrow_destructible_aux {
2911private:
2912 template <typename T1>
2913 static bool_constant<noexcept(declval<T1&>().~T1())> __test(int);
2914
2915 template <typename>
2916 static false_type __test(...);
2917
2918public:
2919 using type = decltype(__test<T>(0));
2920};
2921
2922template <typename T, bool = disjunction<is_void<T>, is_unbounded_array<T>, is_function<T>>::value,
2923 bool = disjunction<is_reference<T>, is_scalar<T>>::value>
2924struct __is_nothrow_destructible_dispatch;
2925
2926template <typename T>
2927struct __is_nothrow_destructible_dispatch<T, false, false>
2928: __is_nothrow_destructible_aux<remove_all_extents_t<T>>::type {};
2929
2930template <typename T>
2931struct __is_nothrow_destructible_dispatch<T, true, false> : false_type {};
2932
2933template <typename T>
2934struct __is_nothrow_destructible_dispatch<T, false, true> : true_type {};
2935NEFORCE_END_INNER__
2937#endif
2938
2939
2945template <typename T>
2947
2949template <typename T>
2951#ifdef NEFORCE_COMPILER_MSVC
2952 bool_constant<__is_nothrow_destructible(T)> {
2953};
2954#else
2955 inner::__is_nothrow_destructible_dispatch<T>::type {
2956};
2957#endif
2959
2960#ifdef NEFORCE_STANDARD_14
2965template <typename T>
2967#endif
2968
2969
2978template <typename T>
2980
2981#ifdef NEFORCE_STANDARD_14
2986template <typename T>
2988#endif
2989 // TypeSpecialMemberFunctionChecks
2991
2997
3006template <typename T>
3007NEFORCE_NODISCARD constexpr T&& forward(remove_reference_t<T>& x) noexcept {
3008 return static_cast<T&&>(x);
3009}
3010
3020template <typename T>
3021NEFORCE_NODISCARD constexpr T&& forward(remove_reference_t<T>&& x) noexcept {
3022 static_assert(!is_lvalue_reference<T>::value, "forward failed.");
3023 return static_cast<T&&>(x);
3024}
3025
3034template <typename T>
3035NEFORCE_NODISCARD constexpr remove_reference_t<T>&& move(T&& x) noexcept {
3036 return static_cast<remove_reference_t<T>&&>(x);
3037}
3038
3047template <typename T>
3049 const T&, T&&>
3050move_if_noexcept(T& x) noexcept {
3051 return _NEFORCE move(x);
3052}
3053
3062template <typename T>
3063NEFORCE_NODISCARD constexpr T* addressof(T& x) noexcept {
3064 return __builtin_addressof(x);
3065}
3066
3072template <typename T>
3073const T* addressof(const T&&) = delete;
3074
3075
3076template <typename T, typename U>
3077constexpr size_t offset_of(U T::* member) {
3078 return reinterpret_cast<size_t>(&(reinterpret_cast<T const volatile*>(nullptr)->*member));
3079}
3080
3081 // ArgsForwardFunctions
3083
3089
3090#if !defined(NEFORCE_COMPILER_MSVC) && !defined(NEFORCE_COMPILER_CLANG)
3092NEFORCE_BEGIN_INNER__
3093template <typename From, typename To, bool = disjunction_v<is_void<From>, is_function<To>, is_array<To>>>
3094struct __is_convertible_helper {
3095 using type = typename is_void<To>::type;
3096};
3097
3098template <typename From, typename To>
3099struct __is_convertible_helper<From, To, false> {
3100private:
3101 template <typename From1, typename To1, typename = decltype(_NEFORCE declvoid<To1>(_NEFORCE declval<From1>()))>
3102 static true_type __test(int);
3103
3104 template <typename, typename>
3105 static false_type __test(...);
3106
3107public:
3108 using type = decltype(__test<From, To>(0));
3109};
3110NEFORCE_END_INNER__
3112#endif
3113
3120template <typename From, typename To>
3122#if defined(NEFORCE_COMPILER_MSVC)
3123 bool_constant<__is_convertible_to(From, To)> {
3124};
3125#elif defined(NEFORCE_COMPILER_CLANG)
3126 bool_constant<__is_convertible(From, To)> {
3127};
3128#else
3129 inner::__is_convertible_helper<From, To>::type {
3130};
3131#endif
3132
3133#ifdef NEFORCE_STANDARD_14
3138template <typename From, typename To>
3139NEFORCE_INLINE17 constexpr bool is_convertible_v = is_convertible<From, To>::value;
3140#endif
3141
3142#if defined(NEFORCE_STANDARD_20) || defined(NEXUSFORCE_ENABLE_DOXYGEN)
3149template <typename From, typename To>
3150concept convertible_to = is_convertible_v<From, To> && requires { static_cast<To>(_NEFORCE declval<From>()); };
3151#endif // NEFORCE_STANDARD_20
3152
3153
3162template <typename ToElement, typename FromElement>
3163using is_array_convertible = is_convertible<FromElement (*)[], ToElement (*)[]>;
3164
3165#ifdef NEFORCE_STANDARD_14
3170template <typename ToElement, typename FromElement>
3172#endif
3173
3174
3183template <typename From, typename To, bool IsConvertible = is_convertible<From, To>::value,
3184 bool IsVoid = is_void<To>::value>
3185struct is_nothrow_convertible : bool_constant<noexcept(_NEFORCE declcopy<To>(_NEFORCE declval<From>()))> {};
3186
3188template <typename From, typename To, bool IsVoid>
3189struct is_nothrow_convertible<From, To, false, IsVoid> : false_type {};
3190
3191template <typename From, typename To>
3192struct is_nothrow_convertible<From, To, true, true> : true_type {};
3194
3195#ifdef NEFORCE_STANDARD_14
3200template <typename From, typename To>
3202#endif
3203
3204
3212template <typename Iterator, typename Ptr, bool IsPtr = is_pointer<remove_cvref_t<Iterator>>::value>
3213struct is_nothrow_arrow : bool_constant<is_nothrow_convertible<Iterator, Ptr>::value> {};
3214
3216template <typename Iterator, typename Ptr>
3217struct is_nothrow_arrow<Iterator, Ptr, false>
3218: bool_constant<noexcept(_NEFORCE declcopy<Ptr>(_NEFORCE declval<Iterator>().operator->()))> {};
3220
3221#ifdef NEFORCE_STANDARD_14
3226template <typename Iterator, typename Ptr>
3228#endif
3229 // ConvertibleChecks
3231
3237
3239NEFORCE_BEGIN_INNER__
3240template <size_t>
3241struct __sign_byte_aux;
3242
3243template <>
3244struct __sign_byte_aux<1> {
3245 template <typename>
3246 using signed_t = signed char;
3247 template <typename>
3248 using unsigned_t = unsigned char;
3249};
3250template <>
3251struct __sign_byte_aux<2> {
3252 template <typename>
3253 using signed_t = signed short;
3254 template <typename>
3255 using unsigned_t = unsigned short;
3256};
3257template <>
3258struct __sign_byte_aux<4> {
3259#ifdef NEFORCE_PLATFORM_WINDOWS
3260 template <typename T>
3261 using signed_t = conditional_t<is_same_v<T, signed long> || is_same_v<T, unsigned long>, signed long, signed int>;
3262
3263 template <typename T>
3264 using unsigned_t =
3266#elif defined(NEFORCE_PLATFORM_LINUX)
3267 template <typename>
3268 using signed_t = signed int;
3269 template <typename>
3270 using unsigned_t = unsigned int;
3271#endif
3272};
3273template <>
3274struct __sign_byte_aux<8> {
3275#ifdef NEFORCE_PLATFORM_WINDOWS
3276 template <typename>
3277 using signed_t = signed long long;
3278 template <typename>
3279 using unsigned_t = unsigned long long;
3280#elif defined(NEFORCE_PLATFORM_LINUX)
3281 template <typename T>
3282 using signed_t = conditional_t<is_same<T, signed long>::value || is_same<T, unsigned long>::value, signed long,
3283 signed long long>;
3284
3285 template <typename T>
3286 using unsigned_t = conditional_t<is_same<T, signed long>::value || is_same<T, unsigned long>::value, unsigned long,
3287 unsigned long long>;
3288#endif
3289};
3290
3291template <typename T>
3292using __set_signed_byte = typename __sign_byte_aux<sizeof(T)>::template signed_t<T>;
3293template <typename T>
3294using __set_unsigned_byte = typename __sign_byte_aux<sizeof(T)>::template unsigned_t<T>;
3295
3296template <typename T>
3297struct __set_sign {
3299 "make signed only support non-bool && integral-like types");
3300
3301 using signed_type = copy_cv_t<T, __set_signed_byte<T>>;
3302 using unsigned_type = copy_cv_t<T, __set_unsigned_byte<T>>;
3303};
3304NEFORCE_END_INNER__
3306
3314template <typename T>
3316 using type = typename inner::__set_sign<T>::signed_type;
3317};
3318
3323template <typename T>
3324using make_signed_t = typename make_signed<T>::type;
3325
3333template <typename T>
3335 using type = typename inner::__set_sign<T>::unsigned_type;
3336};
3337
3342template <typename T>
3343using make_unsigned_t = typename make_unsigned<T>::type;
3344
3345
3347NEFORCE_BEGIN_INNER__
3348template <size_t Size, bool IsSigned>
3349struct __make_integer_impl;
3350
3351template <size_t Size>
3352struct __make_integer_impl<Size, true> {
3353 using type = typename __sign_byte_aux<Size>::template signed_t<int>;
3354};
3355
3356template <size_t Size>
3357struct __make_integer_impl<Size, false> {
3358 using type = typename __sign_byte_aux<Size>::template unsigned_t<int>;
3359};
3360NEFORCE_END_INNER__
3362
3369template <size_t Size, bool IsSigned = true>
3371 using type = typename inner::__make_integer_impl<Size, IsSigned>::type;
3372};
3373
3378template <size_t Size, bool IsSigned = true>
3379using make_integer_t = typename make_integer<Size, IsSigned>::type;
3380
3381
3387template <size_t... Values>
3389
3391template <size_t Value>
3392struct max_value<Value> : integral_constant<size_t, Value> {};
3393
3394template <size_t First, size_t Second, size_t... Rest>
3395struct max_value<First, Second, Rest...> : max_value<(First > Second ? First : Second), Rest...> {};
3397
3398#ifdef NEFORCE_STANDARD_14
3399template <size_t... Values>
3400NEFORCE_INLINE17 constexpr size_t max_value_v = max_value<Values...>::value;
3401#endif
3402 // SignManipulation
3404
3410
3416template <typename T>
3417struct alignment_of : integral_constant<size_t, alignof(T)> {};
3418
3419#ifdef NEFORCE_STANDARD_14
3424template <typename T>
3426#endif
3427
3428
3435template <size_t Len, size_t Align = alignof(_NEFORCE max_align_t)>
3437 static_assert((Align & (Align - 1)) == 0, "Alignment must be power of two");
3438
3443 struct alignas(Align) type {
3445 };
3446};
3447
3452template <size_t Len, size_t Align = alignof(_NEFORCE max_align_t)>
3454
3455
3464template <size_t Len, typename... Types>
3466private:
3467 static constexpr size_t required_alignment = max_value<alignof(Types)...>::value;
3468 static constexpr size_t required_size = max_value<sizeof(Types)...>::value;
3469 static constexpr size_t storage_size = (Len > required_size) ? Len : required_size;
3470
3471 static_assert((required_alignment & (required_alignment - 1)) == 0, "Alignment must be power of two");
3472
3473public:
3477 static constexpr size_t alignment_value = required_alignment;
3481 static constexpr size_t size_value = storage_size;
3482
3487 struct alignas(alignment_value) type {
3488 byte_t data[storage_size];
3489 };
3490
3501 template <typename T>
3502 static constexpr bool is_storable() noexcept {
3503 return is_trivially_copyable<T>::value && sizeof(T) <= storage_size && alignof(T) <= alignment_value;
3504 }
3505};
3506
3511template <size_t Len, typename... Types>
3512using aligned_union_t = typename aligned_union<Len, Types...>::type;
3513
3514#ifdef NEFORCE_STANDARD_14
3519template <size_t Len, typename... Types>
3520constexpr size_t aligned_union_v = aligned_union<Len, Types...>::align_value;
3521#endif
3522 // Alignment
3524
3530
3541template <typename T>
3542struct decay {
3543private:
3544 using remove_ref_t = remove_reference_t<T>;
3545 using check_func_t =
3547
3548public:
3549 using type =
3551};
3552
3557template <typename T>
3558using decay_t = typename decay<T>::type;
3559
3560
3562NEFORCE_BEGIN_INNER__
3563template <typename Default, typename, template <typename...> class, typename...>
3564struct __detector {
3565 using value_t = false_type;
3566 using type = Default;
3567};
3568template <typename Default, template <typename...> class Op, typename... Args>
3569struct __detector<Default, void_t<Op<Args...>>, Op, Args...> {
3570 using value_t = true_type;
3571 using type = Op<Args...>;
3572};
3573NEFORCE_END_INNER__
3575
3583template <typename Default, template <typename...> class Op, typename... Args>
3584using detected_or = inner::__detector<Default, void, Op, Args...>;
3585
3590template <typename Default, template <typename...> class Op, typename... Args>
3591using detected_or_t = typename detected_or<Default, Op, Args...>::type;
3592
3593
3605template <typename T1, typename T2>
3606using common_ternary_operator_t = decltype(true ? _NEFORCE declval<T1>() : _NEFORCE declval<T2>());
3607
3608
3610NEFORCE_BEGIN_INNER__
3611template <typename, typename, typename = void>
3612struct __oper_decay_aux {};
3613template <typename T1, typename T2>
3614struct __oper_decay_aux<T1, T2, void_t<common_ternary_operator_t<decay_t<T1>, decay_t<T2>>>> {
3616};
3617NEFORCE_END_INNER__
3619
3625template <typename... Types>
3627
3632template <typename... Types>
3633using common_type_t = typename common_type<Types...>::type;
3634
3636template <>
3637struct common_type<> {};
3638
3639template <typename T1>
3640struct common_type<T1> : common_type<T1, T1> {};
3641
3642template <typename T1, typename T2>
3643struct common_type<T1, T2> : inner::__oper_decay_aux<T1, T2> {};
3644
3645template <typename T1, typename T2, typename... Rest>
3646struct common_type<T1, T2, Rest...> : common_type<common_type_t<T1, T2>, Rest...> {};
3648
3649
3650#ifdef NEFORCE_STANDARD_20
3651
3657template <typename... Types>
3659
3664template <typename... Types>
3665using common_reference_t = typename common_reference<Types...>::type;
3666
3668
3669template <>
3670struct common_reference<> {};
3671
3672template <typename T>
3673struct common_reference<T> {
3674 using type = T;
3675};
3676
3677
3678NEFORCE_BEGIN_INNER__
3679
3680template <typename T1, typename T2>
3681struct __common_reference_base_aux : common_type<T1, T2> {};
3682
3683template <typename T1, typename T2>
3684 requires requires { typename _NEFORCE common_ternary_operator_t<T1, T2>; }
3685struct __common_reference_base_aux<T1, T2> {
3686 using type = _NEFORCE common_ternary_operator_t<T1, T2>;
3687};
3688
3689template <typename, typename, template <typename> typename, template <typename> typename>
3690struct __basic_common_reference {};
3691
3692template <typename T1>
3693struct __add_qualifier_aux {
3694 template <typename T2>
3695 using apply_t = copy_ref_t<T1, copy_cv_t<T1, T2>>;
3696};
3697
3698template <typename T1, typename T2>
3699using qualifier_extract = typename __basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>,
3700 __add_qualifier_aux<T1>::template apply_t,
3701 __add_qualifier_aux<T2>::template apply_t>::type;
3702
3703template <typename T1, typename T2>
3704struct __common_ref_qualify_aux : __common_reference_base_aux<T1, T2> {};
3705
3706template <typename T1, typename T2>
3707 requires requires { typename qualifier_extract<T1, T2>; }
3708struct __common_ref_qualify_aux<T1, T2> {
3709 using type = qualifier_extract<T1, T2>;
3710};
3711
3712template <typename T1, typename T2>
3713struct __common_reference_ptr_aux : __common_ref_qualify_aux<T1, T2> {};
3714
3715template <typename T1, typename T2>
3718
3719template <typename, typename>
3720struct __common_reference_aux {};
3721
3722template <typename T1, typename T2>
3723 requires requires { typename __common_lvalue_aux<T1, T2>; }
3724struct __common_reference_aux<T1&, T2&> {
3725 using type = __common_lvalue_aux<T1, T2>;
3726};
3727
3728template <typename T1, typename T2>
3730struct __common_reference_aux<T1&&, T2&> {
3731 using type = __common_lvalue_aux<const T1, T2>;
3732};
3733
3734template <typename T1, typename T2>
3736struct __common_reference_aux<T1&, T2&&> {
3737 using type = __common_lvalue_aux<const T2, T1>;
3738};
3739
3740template <typename T1, typename T2>
3741using __common_rvalue_aux = remove_reference_t<__common_lvalue_aux<T1, T2>>&&;
3742
3743template <typename T1, typename T2>
3745struct __common_reference_aux<T1&&, T2&&> {
3746 using type = __common_rvalue_aux<T1, T2>;
3747};
3748
3749template <typename T1, typename T2>
3750using __common_reference_aux_t = typename __common_reference_aux<T1, T2>::type;
3751
3752template <typename T1, typename T2>
3755struct __common_reference_ptr_aux<T1, T2> {
3756 using type = __common_reference_aux_t<T1, T2>;
3757};
3758
3759NEFORCE_END_INNER__
3760
3761
3762template <typename T1, typename T2>
3763struct common_reference<T1, T2> : inner::__common_reference_ptr_aux<T1, T2> {};
3764
3765template <typename T1, typename T2, typename T3, typename... Rest>
3766struct common_reference<T1, T2, T3, Rest...> {};
3767
3768template <typename T1, typename T2, typename T3, typename... Rest>
3769 requires requires { typename common_reference_t<T1, T2>; }
3770struct common_reference<T1, T2, T3, Rest...> : common_reference<common_reference_t<T1, T2>, T3, Rest...> {};
3771
3773#endif
3774
3775
3784template <typename T, template <typename...> class Template>
3786
3788template <template <typename...> class Template, typename... Args>
3789struct is_specialization<Template<Args...>, Template> : true_type {};
3791
3792#ifdef NEFORCE_STANDARD_17
3797template <typename T, template <typename...> class Template>
3799#else
3806template <typename T, template <typename...> class Template>
3807constexpr bool is_specialization_v() {
3809}
3810#endif
3811 // TypeAttributeOperations
3813
3819
3820template <typename>
3821struct is_swappable;
3822
3823template <typename>
3824struct is_nothrow_swappable;
3825
3826
3833template <typename T>
3836
3844template <typename T, size_t Size>
3845NEFORCE_CONSTEXPR14 enable_if_t<is_swappable<T>::value> swap(T (&lhs)[Size],
3846 T (&rhs)[Size]) noexcept(is_nothrow_swappable<T>::value);
3847
3851void swap() = delete;
3852
3861template <typename T, typename U = T>
3862NEFORCE_CONSTEXPR14 T exchange(T& val, U&& new_val) noexcept(is_nothrow_move_constructible_v<T> &&
3864
3865
3873template <typename T1, typename T2, typename Dummy = void>
3875
3877template <typename T1, typename T2>
3878struct is_swappable_from<T1, T2, void_t<decltype(_NEFORCE swap(_NEFORCE declval<T1>(), _NEFORCE declval<T2>()))>>
3879: true_type {};
3881
3882
3891template <typename T1, typename T2>
3892struct is_swappable_with : bool_constant<conjunction<is_swappable_from<T1, T2>, is_swappable_from<T2, T1>>::value> {};
3893
3894
3900template <typename T>
3901struct is_swappable : bool_constant<is_swappable_with<add_lvalue_reference_t<T>, add_lvalue_reference_t<T>>::value> {};
3902
3903#ifdef NEFORCE_STANDARD_14
3908template <typename T>
3909NEFORCE_INLINE17 constexpr bool is_swappable_v = is_swappable<T>::value;
3910#endif
3911
3912
3919template <typename T1, typename T2>
3921: bool_constant<noexcept(_NEFORCE swap(_NEFORCE declval<T1>(), _NEFORCE declval<T2>())) &&
3922 noexcept(_NEFORCE swap(_NEFORCE declval<T2>(), _NEFORCE declval<T1>()))> {};
3923
3924
3931template <typename T1, typename T2>
3933: bool_constant<conjunction<is_swappable_with<T1, T2>, is_nothrow_swappable_from<T1, T2>>::value> {};
3934
3935
3941template <typename T>
3943: bool_constant<is_nothrow_swappable_with<add_lvalue_reference_t<T>, add_lvalue_reference_t<T>>::value> {};
3944
3945#ifdef NEFORCE_STANDARD_14
3950template <typename T>
3952#endif
3953
3954
3965template <typename T, typename Dummy = void>
3967
3969template <typename T>
3970struct is_ADL_swappable<T, void_t<decltype(swap(_NEFORCE declval<T&>(), _NEFORCE declval<T&>()))>> : true_type {};
3972
3973
3985template <typename T>
3987: bool_constant<conjunction<is_trivially_destructible<T>, is_trivially_move_constructible<T>,
3988 is_trivially_move_assignable<T>, negation<is_ADL_swappable<T>>>::value> {};
3989
3990#ifdef NEFORCE_STANDARD_14
3995template <typename T>
3997#endif
3998
4000
4001template <typename T>
4004 T tmp = _NEFORCE move(lhs);
4005 lhs = _NEFORCE move(rhs);
4006 rhs = _NEFORCE move(tmp);
4007 return;
4008}
4009
4010template <typename T, size_t Size>
4011NEFORCE_CONSTEXPR14 enable_if_t<is_swappable<T>::value> swap(T (&lhs)[Size],
4012 T (&rhs)[Size]) noexcept(is_nothrow_swappable<T>::value) {
4013 if (&lhs == &rhs) {
4014 return;
4015 }
4016 T* first1 = lhs;
4017 T* last1 = first1 + Size;
4018 T* first2 = rhs;
4019 for (; first1 != last1; ++first1, ++first2) {
4020 _NEFORCE swap(*first1, *first2);
4021 }
4022 return;
4023}
4024
4025template <typename T, typename U>
4026NEFORCE_CONSTEXPR14 T exchange(T& val, U&& new_val) noexcept(is_nothrow_move_constructible_v<T> &&
4028 T old_val = _NEFORCE move(val);
4029 val = _NEFORCE forward<U>(new_val);
4030 return old_val;
4031}
4032
4034 // SwapUtility
4036
4042
4043#ifdef NEFORCE_STANDARD_20
4053template <typename T>
4054concept is_pair_v = requires(T p) {
4055 typename T::first_type;
4056 typename T::second_type;
4057 p.first;
4058 p.second;
4059};
4060#endif // NEFORCE_STANDARD_20
4061
4062
4073template <typename Alloc, typename Dummy = void>
4075
4077template <typename Alloc>
4078struct is_allocator<Alloc, void_t<typename Alloc::value_type, decltype(declval<Alloc&>().allocate(size_t{}))>>
4079: true_type {};
4081
4082#ifdef NEFORCE_STANDARD_14
4087template <typename Alloc>
4088NEFORCE_INLINE17 constexpr bool is_allocator_v = is_allocator<Alloc>::value;
4089#endif
4090
4091
4093NEFORCE_BEGIN_INNER__
4094template <typename T>
4095struct __has_valid_begin_end {
4096private:
4097 template <typename U>
4098 static auto __test(int)
4099 -> decltype(declval<U>().begin(), declval<U>().end(),
4100 is_same<decltype(declval<U>().begin()), decltype(declval<U>().end())>(), true_type{});
4101
4102 template <typename U>
4103 static false_type __test(...);
4104
4105public:
4106 static constexpr bool value = decltype(__test<T>(0))::value;
4107};
4108NEFORCE_END_INNER__
4110
4111
4117template <typename Iterator>
4119private:
4120 template <typename U>
4121 static auto __test(int) -> decltype(++declval<U&>(), true_type{});
4122
4123 template <typename U>
4124 static false_type __test(...);
4125
4126public:
4127 static constexpr bool value = decltype(__test<Iterator>(0))::value;
4128};
4129
4130#ifdef NEFORCE_STANDARD_14
4135template <typename Iterator>
4136NEFORCE_INLINE17 constexpr bool is_incrementible_v = is_incrementible<Iterator>::value;
4137#endif
4138
4139
4145template <typename Iterator>
4147private:
4148 template <typename U>
4149 static auto __test(int) -> decltype(--declval<U&>(), true_type{});
4150
4151 template <typename U>
4152 static false_type __test(...);
4153
4154public:
4155 static constexpr bool value = decltype(__test<Iterator>(0))::value;
4156};
4157
4158#ifdef NEFORCE_STANDARD_14
4163template <typename Iterator>
4164NEFORCE_INLINE17 constexpr bool is_decrementible_v = is_decrementible<Iterator>::value;
4165#endif
4166
4167
4177template <typename Container>
4178struct is_iterable : bool_constant<inner::__has_valid_begin_end<Container>::value &&
4179 is_incrementible<decltype(declval<Container>().begin())>::value> {};
4180
4181#ifdef NEFORCE_STANDARD_14
4186template <typename T>
4187NEFORCE_INLINE17 constexpr bool is_iterable_v = is_iterable<T>::value;
4188#endif
4189
4190
4192NEFORCE_BEGIN_INNER__
4193template <typename T>
4194struct __has_first_and_second {
4195private:
4196 template <typename U>
4197 static auto __test(int) -> decltype(declval<U>().first, declval<U>().second, true_type{});
4198
4199 template <typename U>
4200 static false_type __test(...);
4201
4202public:
4203 static constexpr bool value = decltype(__test<T>(0))::value;
4204};
4205NEFORCE_END_INNER__
4207
4217template <typename Map>
4219: bool_constant<is_iterable<Map>::value &&
4220 inner::__has_first_and_second<decltype(*declval<decltype(declval<Map>().begin())>())>::value> {};
4221
4222#ifdef NEFORCE_STANDARD_14
4227template <typename Map>
4228NEFORCE_INLINE17 constexpr bool is_maplike_v = is_maplike<Map>::value;
4229#endif
4230
4231
4233NEFORCE_BEGIN_INNER__
4234template <typename Alloc, typename T, typename... Args>
4235struct __has_construct_impl {
4236private:
4237 template <typename Alloc1, typename = decltype(_NEFORCE declval<Alloc1*>()->construct(_NEFORCE declval<T*>(),
4238 _NEFORCE declval<Args>()...))>
4239 static true_type __test(int);
4240
4241 template <typename>
4242 static false_type __test(...);
4243
4244public:
4245 using type = decltype(__test<Alloc>(0));
4246};
4247NEFORCE_END_INNER__
4249
4257template <typename Alloc, typename T, typename... Args>
4258struct has_construct : inner::__has_construct_impl<Alloc, T, Args...>::type {};
4259
4260#ifdef NEFORCE_STANDARD_14
4265template <typename Alloc, typename T, typename... Args>
4266NEFORCE_INLINE17 constexpr bool has_construct_v = has_construct<Alloc, T, Args...>::value;
4267#endif
4268
4269
4271NEFORCE_BEGIN_INNER__
4272template <typename T>
4273struct __has_base_impl {
4274private:
4275 template <typename U>
4276 static auto __test(int) -> decltype(_NEFORCE declval<const U>().base(), true_type{});
4277
4278 template <typename U>
4279 static false_type __test(...);
4280
4281public:
4282 static constexpr bool value = decltype(__test<T>(0))::value;
4283};
4284NEFORCE_END_INNER__
4286
4292template <typename T>
4293struct has_base : bool_constant<inner::__has_base_impl<T>::value> {};
4294
4295#ifdef NEFORCE_STANDARD_14
4300template <typename T>
4301NEFORCE_INLINE17 constexpr bool has_base_v = has_base<T>::value;
4302#endif
4303 // TypeActionCheck
4305
4311
4322template <typename T>
4323NEFORCE_ALWAYS_INLINE constexpr T initialize() noexcept(is_nothrow_default_constructible<T>::value) {
4324 static_assert(is_default_constructible<T>::value, "T must be default constructible");
4325 return T();
4326}
4327
4328#define __NEFORCE_INITIALIZE_BASIC_FUNCTION(OPT) \
4329 template <> \
4330 NEFORCE_ALWAYS_INLINE constexpr OPT initialize() noexcept { \
4331 return static_cast<OPT>(0); \
4332 }
4333
4334NEFORCE_MACRO_RANGE_ARITHMETIC(__NEFORCE_INITIALIZE_BASIC_FUNCTION)
4335#undef __NEFORCE_INITIALIZE_BASIC_FUNCTION
4336 // TypeInitializeFunction
4338 // TypeTraits
4340
4341NEFORCE_END_NAMESPACE__
4342#endif // NEFORCE_CORE_TYPEINFO_TYPE_TRAITS_HPP__
检查类型From是否可以转换为类型To
检查类型是否具有类似pair的结构
NEFORCE_NODISCARD constexpr add_const_t< T > & as_const(T &val) noexcept
将值转换为const引用
typename add_volatile< T >::type add_volatile_t
add_volatile的便捷别名
typename add_pointer< T >::type add_pointer_t
add_pointer的便捷别名
typename add_const< T >::type add_const_t
add_const的便捷别名
typename add_cv< T >::type add_cv_t
add_cv的类型别名
typename add_reference< T >::lvalue add_lvalue_reference_t
add_lvalue_reference的便捷别名
typename add_reference< T >::rvalue add_rvalue_reference_t
add_rvalue_reference的便捷别名
constexpr size_t aligned_union_v
获取aligned_union的对齐要求值
typename aligned_union< Len, Types... >::type aligned_union_t
aligned_union的便捷别名
typename aligned_storage< Len, Align >::type aligned_storage_t
aligned_storage的便捷别名
constexpr size_t alignment_of_v
alignment_of的便捷变量模板
NEFORCE_NODISCARD constexpr T * addressof(T &x) noexcept
获取对象的地址
NEFORCE_NODISCARD constexpr remove_reference_t< T > && move(T &&x) noexcept
无条件转换为右值引用
NEFORCE_NODISCARD constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
NEFORCE_NODISCARD constexpr conditional_t<!is_nothrow_move_constructible< T >::value &&is_copy_constructible< T >::value, const T &, T && > move_if_noexcept(T &x) noexcept
在安全的情况下执行移动操作
NEFORCE_INLINE17 constexpr size_t rank_v
rank的便捷变量模板
NEFORCE_INLINE17 constexpr size_t extent_v
extent的便捷变量模板
typename unpackage< T >::type unpackage_t
unpackage的便捷别名
NEFORCE_INLINE17 constexpr bool is_floating_point_v
is_floating_point的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_packaged_v
is_packaged的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_character_v
is_character的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_unpackaged_v
is_unpackaged的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_integral_v
is_integral的便捷变量模板
unpackage_t< remove_cvref_t< T > > unpack_remove_cvref_t
同时解包并移除cv和引用限定符
NEFORCE_INLINE17 constexpr bool is_signed_v
is_signed的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_arithmetic_v
is_arithmetic的便捷变量模板
typename package< T >::type package_t
package的便捷别名
NEFORCE_INLINE17 constexpr bool is_unsigned_v
is_unsigned的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_boolean_v
is_boolean的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_void_v
is_void的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_standard_integral_v
is_standard_integral的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_compound_v
is_compound的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_bounded_array_v
is_bounded_array的便捷变量模板
typename underlying_type< T >::type underlying_type_t
underlying_type的便捷别名
NEFORCE_INLINE17 constexpr bool is_polymorphic_v
is_polymorphic的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_base_of_v
is_base_of的便捷变量模板
constexpr bool is_pointer_interconvertible_with_class(Mem T::*mp) noexcept
判断成员指针是否指向类对象的起始位置
NEFORCE_INLINE17 constexpr bool is_member_object_pointer_v
is_member_object_pointer的便捷变量模板
constexpr bool is_corresponding_member(M1 S1::*m1, M2 S2::*m2) noexcept
判断两个成员指针是否指向对应位置的成员
NEFORCE_INLINE17 constexpr bool is_standard_layout_v
is_standard_layout的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_reference_v
is_reference的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_unbounded_array_v
is_unbounded_array的便捷变量模板
constexpr bool is_cstring_v
is_cstring的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_member_pointer_v
is_member_pointer的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_aggregate_v
is_aggregate的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_const_v
is_const的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_enum_v
is_enum的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_integral_like_v
is_integral_like的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_allocable_v
is_allocable的便捷变量模板
NEFORCE_INLINE17 constexpr bool has_unique_object_representations_v
has_unique_object_representations的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_lvalue_reference_v
is_lvalue_reference的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_final_v
is_final的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_pod_v
is_pod的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_volatile_v
is_volatile的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_null_pointer_v
is_null_pointer的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_fundamental_v
is_fundamental的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_member_function_pointer_v
is_member_function_pointer的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_class_v
is_class的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_rvalue_reference_v
is_rvalue_reference的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_scalar_v
is_scalar的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_object_v
is_object的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_union_v
is_union的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_array_v
is_array的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_abstract_v
is_abstract的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_empty_v
is_empty的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_pointer_v
is_pointer的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_function_v
is_function的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_convertible_v
is_nothrow_convertible的便捷变量模板
is_convertible< FromElement(*)[], ToElement(*)[]> is_array_convertible
判断数组元素类型FromElement是否可以转换为ToElement
NEFORCE_INLINE17 constexpr bool is_nothrow_arrow_v
is_nothrow_arrow的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_convertible_v
is_convertible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_array_convertible_v
is_array_convertible的便捷变量模板
unsigned char byte_t
字节类型,定义为无符号字符
type_identity_t< T > declcopy(type_identity_t< T >) noexcept
获取类型的副本,仅用于非求值上下文
add_rvalue_reference_t< T > declval() noexcept
获取类型的右值引用,仅用于非求值上下文
void declvoid(type_identity_t< T >) noexcept
将类型映射为void,仅用于非求值上下文
int64_t ptrdiff_t
指针差类型
typename remove_all_extents< T >::type remove_all_extents_t
remove_all_extents的便捷别名
copy_ref_t< From, copy_cv_t< From, To > > copy_cvref_t
同时复制cv和引用限定符
typename remove_pointer< From >::template bind_pointer_t< To > copy_pointer_t
复制指针限定符
typename remove_function_qualifiers< T >::type remove_function_qualifiers_t
remove_function_qualifiers的便捷别名
typename remove_cvref< T >::type remove_cvref_t
remove_cvref的便捷别名
typename remove_cv< From >::template bind_cv_t< To > copy_cv_t
复制cv限定符
typename remove_volatile< T >::type remove_volatile_t
remove_volatile的便捷别名
typename remove_reference< T >::type remove_reference_t
remove_reference的便捷别名
typename remove_const< T >::type remove_const_t
remove_const的便捷别名
typename remove_pointer< T >::type remove_pointer_t
remove_pointer的便捷别名
typename remove_cv< T >::type remove_cv_t
remove_cv的便捷别名
typename remove_reference< From >::template bind_ref_t< To > copy_ref_t
复制引用限定符
typename remove_extent< T >::type remove_extent_t
remove_extent的便捷别名
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result) noexcept(noexcept(inner::__move_aux(first, last, result)))
移动范围元素
typename make_integer< Size, IsSigned >::type make_integer_t
make_integer的便捷别名
typename make_unsigned< T >::type make_unsigned_t
make_unsigned的便捷别名
typename make_signed< T >::type make_signed_t
make_signed的便捷别名
NEFORCE_CONSTEXPR14 T exchange(T &val, U &&new_val) noexcept(is_nothrow_move_constructible_v< T > &&is_nothrow_assignable_v< T &, U >)
将新值赋给对象并返回旧值
NEFORCE_INLINE17 constexpr bool is_trivially_swappable_v
is_trivially_swappable的便捷变量模板
void swap()=delete
删除无参数的swap重载
NEFORCE_INLINE17 constexpr bool is_nothrow_swappable_v
is_nothrow_swappable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_swappable_v
is_swappable的便捷变量模板
typename get_first_para< Types... >::type get_first_para_t
get_first_para的便捷别名
typename get_ptr_difference< T >::type get_ptr_difference_t
get_ptr_difference的便捷别名
typename replace_first_para< T, U >::type replace_first_para_t
replace_first_para的便捷别名
typename get_first_temp_para< Tmp >::type get_first_temp_para_t
get_first_temp_para的便捷别名
typename get_rebind_type< T, U >::type get_rebind_type_t
get_rebind_type的便捷别名
NEFORCE_INLINE17 constexpr bool is_maplike_v
is_maplike的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_iterable_v
is_iterable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_allocator_v
is_allocator的便捷变量模板
NEFORCE_INLINE17 constexpr bool has_base_v
has_base的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_decrementible_v
is_decrementible的便捷变量模板
NEFORCE_INLINE17 constexpr bool has_construct_v
has_construct的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_incrementible_v
iis_incrementible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_specialization_v
is_specialization的便捷变量模板
typename common_type< Types... >::type common_type_t
common_type的便捷别名
decltype(true ? _NEFORCE declval< T1 >() :_NEFORCE declval< T2 >()) common_ternary_operator_t
三目运算符的公共类型推导
typename decay< T >::type decay_t
decay的便捷别名
typename detected_or< Default, Op, Args... >::type detected_or_t
detected_or的便捷别名,返回检测到的类型或默认类型
typename common_reference< Types... >::type common_reference_t
common_reference的便捷别名
inner::__detector< Default, void, Op, Args... > detected_or
检测Op<Args...>是否有效,如果无效则使用Default类型
NEFORCE_NODISCARD NEFORCE_ALWAYS_INLINE constexpr decltype(auto) end(Container &cont) noexcept(noexcept(cont.end()))
获取容器的结束迭代器
NEFORCE_ALWAYS_INLINE constexpr T initialize() noexcept(is_nothrow_default_constructible< T >::value)
返回类型T的默认初始化值
#define NEFORCE_MACRO_RANGES_CV_REF_NOEXCEPT(MAC)
cv、引用和noexcept限定符列表宏
#define NEFORCE_MACRO_RANGES_CV(MAC)
cv限定符列表宏
#define NEFORCE_MACRO_RANGES_CV_REF(MAC)
cv和引用限定符列表宏
#define NEFORCE_MACRO_RANGE_ARITHMETIC(MAC)
所有算术类型列表宏
NEFORCE_INLINE17 constexpr bool is_nothrow_default_constructible_v
is_nothrow_default_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool has_virtual_destructor_v
has_virtual_destructor的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_assignable_v
is_nothrow_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_constructible_v
is_nothrow_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_copy_assignable_v
is_nothrow_copy_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_copy_constructible_v
is_copy_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_location_invariant_v
is_location_invariant的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_assignable_v
is_trivially_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_default_constructible_v
is_trivially_default_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_move_assignable_v
is_nothrow_move_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_assignable_v
is_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_constructible_v
is_trivially_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_destructible_v
is_trivially_destructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_destructible_v
is_nothrow_destructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_move_assignable_v
is_move_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_copyable_v
is_trivially_copyable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_copy_constructible_v
is_trivially_copy_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_default_constructible_v
is_default_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_destructible_v
is_destructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_constructible_v
is_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_move_constructible_v
is_move_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_move_constructible_v
is_trivially_move_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_copy_assignable_v
is_trivially_copy_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_move_constructible_v
is_nothrow_move_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivially_move_assignable_v
is_trivially_move_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_trivial_v
is_trivial的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_implicitly_default_constructible_v
is_implicitly_default_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_nothrow_copy_constructible_v
is_nothrow_copy_constructible的便捷变量模板
NEFORCE_INLINE17 constexpr bool is_copy_assignable_v
is_copy_assignable的便捷变量模板
NEFORCE_INLINE17 constexpr bool disjunction_v
disjunction的便捷变量模板
integral_constant< uint64_t, Value > uint64_constant
64位无符号整数常量包装器
NEFORCE_INLINE17 constexpr bool is_same_v
is_same的便捷变量模板
NEFORCE_INLINE17 constexpr bool negation_v
negation的便捷变量模板
typename conditional< Test, T1, T2 >::type conditional_t
conditional的便捷别名
integral_constant< uint32_t, Value > uint32_constant
32位无符号整数常量包装器
NEFORCE_INLINE17 constexpr bool is_any_of_v
is_any_of的便捷变量模板
bool_constant< true > true_type
表示true的类型
void void_t
将任意类型映射为void
typename type_identity< T >::type type_identity_t
type_identity的便捷别名
bool_constant< false > false_type
表示false的类型
integral_constant< bool, Value > bool_constant
布尔常量包装器
NEFORCE_INLINE17 constexpr bool conjunction_v
conjunction的便捷变量模板
typename enable_if< Test, T >::type enable_if_t
enable_if的便捷别名
void swap(unique_ptr< T, Deleter > &lhs, unique_ptr< T, Deleter > &rhs) noexcept
交换两个unique_ptr
添加const限定符
同时添加const和volatile限定符
添加指针限定符
添加引用限定符
添加volatile限定符
实际的对齐存储类型
byte_t data[Len]
原始存储数据
创建指定大小和对齐要求的存储类型
实际的对齐存储类型
byte_t data[storage_size]
原始存储数据
创建可以容纳多种类型的对齐存储类型
static constexpr bool is_storable() noexcept
检查指定类型是否可以安全存储在aligned_union中
static constexpr size_t size_value
存储的实际大小
static constexpr size_t alignment_value
存储的对齐要求
查询类型的对齐要求
查找多个类型的公共引用类型
查找多个类型的公共类型
条件选择类型
类型集合的逻辑与操作
模拟函数参数传递中的类型退化
类型集合的逻辑或操作
条件启用模板
查询数组指定维度的大小
提取参数列表的第一个类型参数
提取模板的第一个类型参数
获取指针的差值类型
获取指针的重新绑定类型
判断类型是否具有base成员函数
判断分配器是否具有construct成员函数
判断类型是否具有唯一的对象表示
判断类型是否具有虚析构函数
整数常量包装器
integral_constant< T, Value > type
自身类型
NEFORCE_NODISCARD constexpr value_type operator()() const noexcept
判断类型是否支持通过ADL查找的swap
判断类型是否为抽象类型
判断类型是否为聚合类型
判断类型是否可以进行内存分配
判断类型是否为分配器
判断类型是否在类型集合中
判断类型是否为算术类型
判断类型是否为数组类型
判断类型是否可以使用指定类型的值进行赋值
判断Base是否是Derived的基类
判断类型是否为布尔类型
判断类型是否为有界数组
判断类型是否为字符类型
判断类型是否为类类型
判断类型是否为复合类型
判断类型是否被const限定
判断类型是否可以使用指定参数构造
判断类型From是否可以隐式转换为类型To
判断类型是否可复制赋值
判断类型是否可复制构造
判断类型是否为C风格字符串类型
判断类型是否可以递减
判断类型是否可默认构造
判断类型是否可析构
判断类型是否为空类型
判断类型是否为枚举类型
判断类型是否被final限定
判断类型是否为浮点数类型
判断类型是否为函数类型
判断类型是否为基本类型
判断类型是否可隐式默认构造
判断类型是否可以递增
判断类型是否为类整数类型
判断类型是否为整数类型
判断类型是否可迭代
判断类型是否是位置不变的
判断类型是否为左值引用
判断类型是否类似映射
判断类型是否为成员函数指针
判断类型是否为成员对象指针
判断类型是否为成员指针
判断类型是否可移动赋值
判断类型是否可移动构造
判断迭代器的箭头运算符是否不会抛出异常
判断类型是否可以使用指定类型的值进行无异常赋值
判断类型是否可以使用指定参数无异常构造
判断类型From是否可以无异常地转换为类型To
判断类型是否可无异常复制赋值
判断类型是否可无异常复制构造
判断类型是否可无异常默认构造
判断类型是否可无异常析构
判断类型是否可无异常移动赋值
判断类型是否可无异常移动构造
判断是否可以无异常地从T1交换到T2
判断两个类型是否可以无异常地互相交换
判断类型是否可以与自身无异常交换
判断类型是否为nullptr_t
判断类型是否为对象类型
判断类型是否被包装
判断类型是否为POD类型
判断类型是否为指针类型
判断类型是否为多态类型
判断类型是否为引用类型
判断类型是否为右值引用
判断两个类型是否相同
判断类型是否为标量类型
判断类型是否为有符号类型
判断类型T是否为模板Template的特化
判断类型是否为标准整数类型
判断类型是否符合标准布局
判断是否可以调用swap从T1交换到T2
判断两个类型是否可以互相交换
判断类型是否可以与自身交换
判断类型是否为平凡类型
判断类型是否可以使用指定类型的值进行平凡赋值
判断类型是否可以使用指定参数平凡构造
判断类型是否可平凡复制赋值
判断类型是否可平凡复制构造
判断类型是否为平凡可复制类型
判断类型是否可平凡默认构造
判断类型是否可平凡析构
判断类型是否可平凡移动赋值
判断类型是否可平凡移动构造
判断类型是否可以平凡交换
判断类型是否为无界数组
判断类型是否为联合类型
判断类型是否被解包
判断类型是否为无符号类型
判断类型是否为void
判断类型是否被volatile限定
根据大小和符号创建整数类型
将类整数类型转换为对应的有符号类型
将类整数类型转换为对应的无符号类型
获取值列表中的最大值
逻辑非包装器
类型包装器模板
查询数组的维度数
移除数组的所有维度
移除const限定符
移除const和volatile限定符
wrapper bind_cv_t
将原类型的cv限定符应用到其他类型
同时移除cv和引用限定符的类型包装
移除数组的最外层维度
移除函数类型的限定符
移除指针限定符
wrapper bind_pointer_t
将原类型的指针限定符应用到其他类型
移除引用限定符
wrapper bind_ref_t
将原类型的引用限定符应用到其他类型
移除volatile限定符
替换模板的第一个类型参数
类型标识包装器
获取枚举类型的底层整数类型
类型解包器模板
基本类型别名