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
1683template <typename T, typename = void>
1684struct is_complete : false_type {};
1685
1686template <typename T>
1687struct is_complete<T, void_t<decltype(sizeof(T))>> : true_type {};
1688
1689#ifdef NEFORCE_STANDARD_14
1690template <typename T>
1691NEFORCE_INLINE17 constexpr bool is_complete_v = is_complete<T>::value;
1692#endif
1693
1694
1700template <typename T>
1702
1704template <typename T>
1705struct is_const<const T> : true_type {};
1707
1708#ifdef NEFORCE_STANDARD_14
1713template <typename T>
1714NEFORCE_INLINE17 constexpr bool is_const_v = is_const<T>::value;
1715#endif
1716
1717
1723template <typename T>
1725
1727template <typename T>
1728struct is_volatile<volatile T> : true_type {};
1730
1731#ifdef NEFORCE_STANDARD_14
1736template <typename T>
1737NEFORCE_INLINE17 constexpr bool is_volatile_v = is_volatile<T>::value;
1738#endif
1739
1740
1741#ifdef NEFORCE_COMPILER_MSVC
1742// 禁用MSVC警告4180:从const限定的函数类型中移除const
1743# pragma warning(push)
1744# pragma warning(disable : 4180)
1745#endif
1746
1755template <typename T>
1756struct is_function : bool_constant<!is_const<const remove_function_qualifiers_t<T>>::value &&
1757 !is_reference<remove_function_qualifiers_t<T>>::value> {};
1758
1759#ifdef NEFORCE_STANDARD_14
1764template <typename T>
1765NEFORCE_INLINE17 constexpr bool is_function_v = is_function<T>::value;
1766#endif
1767
1768#ifdef NEFORCE_COMPILER_MSVC
1769# pragma warning(pop)
1770#endif
1771
1772
1785template <typename T>
1787: bool_constant<!(is_void<T>::value || is_reference<T>::value || is_function<T>::value || is_const<T>::value) &&
1788 is_complete<T>::value> {};
1789
1790#ifdef NEFORCE_STANDARD_14
1795template <typename T>
1796NEFORCE_INLINE17 constexpr bool is_allocable_v = is_allocable<T>::value;
1797#endif
1798
1799
1800#ifdef NEFORCE_COMPILER_MSVC
1801# pragma warning(push)
1802# pragma warning(disable : 4180)
1803#endif
1804
1813template <typename T>
1814struct is_object : bool_constant<is_const<const T>::value && !is_void<T>::value> {};
1815
1816#ifdef NEFORCE_STANDARD_14
1821template <typename T>
1822NEFORCE_INLINE17 constexpr bool is_object_v = is_object<T>::value;
1823#endif
1824
1825#ifdef NEFORCE_COMPILER_MSVC
1826# pragma warning(pop)
1827#endif
1828
1829
1839template <typename T>
1841: bool_constant<(is_pointer<remove_cvref_t<T>>::value && is_character<remove_pointer_t<remove_cvref_t<T>>>::value) ||
1842 (is_bounded_array<remove_cvref_t<T>>::value &&
1843 is_character<remove_all_extents_t<remove_cvref_t<T>>>::value)> {};
1844
1845#ifdef NEFORCE_STANDARD_14
1850template <typename T>
1852#endif
1853
1854
1860template <typename T>
1862
1864#ifdef NEFORCE_COMPILER_CLANG
1865template <typename T>
1866struct is_member_function_pointer : bool_constant<__is_member_function_pointer(T)> {};
1867#else
1868NEFORCE_BEGIN_INNER__
1869template <typename>
1870struct __is_member_function_pointer_aux : false_type {};
1871template <typename T, typename C>
1872struct __is_member_function_pointer_aux<T C::*> : is_function<T> {};
1873NEFORCE_END_INNER__
1874
1875template <typename T>
1876struct is_member_function_pointer : inner::__is_member_function_pointer_aux<remove_cv_t<T>> {};
1877#endif
1879
1880#ifdef NEFORCE_STANDARD_14
1885template <typename T>
1887#endif
1888
1889
1895template <typename T>
1897
1899#ifdef NEFORCE_COMPILER_CLANG
1900template <typename T>
1901struct is_member_object_pointer : bool_constant<__is_member_object_pointer(T)> {};
1902#else
1903template <typename T>
1905template <typename T, typename C>
1906struct is_member_object_pointer<T C::*> : bool_constant<!is_function<T>::value> {};
1907#endif
1909
1910#ifdef NEFORCE_STANDARD_14
1915template <typename T>
1917#endif
1918
1919
1925template <typename T>
1927
1929#ifdef NEFORCE_COMPILER_CLANG
1930template <typename T>
1931struct is_member_pointer : bool_constant<__is_member_pointer(T)> {};
1932#else
1933template <typename T>
1934struct is_member_pointer : bool_constant<is_member_object_pointer<T>::value || is_member_function_pointer<T>::value> {};
1935#endif
1937
1938#ifdef NEFORCE_STANDARD_14
1943template <typename T>
1944NEFORCE_INLINE17 constexpr bool is_member_pointer_v = is_member_pointer<T>::value;
1945#endif
1946
1947
1960template <typename T>
1963 disjunction<is_arithmetic<T>, is_enum<T>, is_pointer<T>, is_member_pointer<T>, is_null_pointer<T>>::value> {};
1964
1965#ifdef NEFORCE_STANDARD_14
1970template <typename T>
1971NEFORCE_INLINE17 constexpr bool is_scalar_v = is_scalar<T>::value;
1972#endif
1973
1974
1985template <typename T>
1986struct is_empty : bool_constant<__is_empty(T)> {};
1987
1988#ifdef NEFORCE_STANDARD_14
1993template <typename T>
1994NEFORCE_INLINE17 constexpr bool is_empty_v = is_empty<T>::value;
1995#endif
1996
1997
2005template <typename T>
2006struct is_polymorphic : bool_constant<__is_polymorphic(T)> {};
2007
2008#ifdef NEFORCE_STANDARD_14
2013template <typename T>
2014NEFORCE_INLINE17 constexpr bool is_polymorphic_v = is_polymorphic<T>::value;
2015#endif
2016
2017
2025template <typename T>
2026struct is_abstract : bool_constant<__is_abstract(T)> {};
2027
2028#ifdef NEFORCE_STANDARD_14
2033template <typename T>
2034NEFORCE_INLINE17 constexpr bool is_abstract_v = is_abstract<T>::value;
2035#endif
2036
2037
2045template <typename T>
2046struct is_final : bool_constant<__is_final(T)> {};
2047
2048#ifdef NEFORCE_STANDARD_14
2053template <typename T>
2054NEFORCE_INLINE17 constexpr bool is_final_v = is_final<T>::value;
2055#endif
2056
2057
2059NEFORCE_BEGIN_INNER__
2060template <typename T, bool = is_enum<T>::value>
2061struct __underlying_type_aux {
2062 using type = __underlying_type(T);
2063};
2064template <typename T>
2065struct __underlying_type_aux<T, false> {};
2066NEFORCE_END_INNER__
2068
2076template <typename T>
2077struct underlying_type : inner::__underlying_type_aux<T> {};
2078
2083template <typename T>
2085
2086
2098template <typename T>
2099struct is_standard_layout : bool_constant<__is_standard_layout(T)> {};
2100
2101#ifdef NEFORCE_STANDARD_14
2106template <typename T>
2107NEFORCE_INLINE17 constexpr bool is_standard_layout_v = is_standard_layout<T>::value;
2108#endif
2109
2110
2118template <typename T>
2119struct is_pod : bool_constant<__is_pod(T)> {};
2120
2121#ifdef NEFORCE_STANDARD_14
2126template <typename T>
2127NEFORCE_INLINE17 constexpr bool is_pod_v = is_pod<T>::value;
2128#endif
2129
2130
2143template <typename T>
2144struct has_unique_object_representations : bool_constant<__has_unique_object_representations(T)> {};
2145
2146#ifdef NEFORCE_STANDARD_14
2151template <typename T>
2153#endif
2154
2155
2168template <typename T>
2170
2172#ifdef NEFORCE_COMPILER_MSVC
2173template <typename T>
2174struct is_aggregate : bool_constant<is_array<T>::value || __is_aggregate(T)> {};
2175#else
2176template <typename T>
2177struct is_aggregate : bool_constant<__is_aggregate(remove_cv_t<T>)> {};
2178#endif
2180
2181#ifdef NEFORCE_STANDARD_14
2186template <typename T>
2187NEFORCE_INLINE17 constexpr bool is_aggregate_v = is_aggregate<T>::value;
2188#endif
2189
2190
2191#ifdef NEFORCE_COMPILER_MSVC
2202template <typename T1, typename T2>
2203struct is_layout_compatible : bool_constant<__is_layout_compatible(T1, T2)> {};
2204
2209# ifdef NEFORCE_STANDARD_14
2210template <typename T1, typename T2>
2212# endif
2213
2214
2223template <typename Base, typename Derived>
2224struct is_pointer_interconvertible_base_of : bool_constant<__is_pointer_interconvertible_base_of(Base, Derived)> {};
2225
2226# ifdef NEFORCE_STANDARD_14
2231template <typename Base, typename Derived>
2232NEFORCE_INLINE17 constexpr bool is_pointer_interconvertible_base_of_v =
2234# endif
2235#endif
2236
2237
2244template <typename Base, typename Derived>
2245struct is_base_of : bool_constant<__is_base_of(Base, Derived)> {};
2246
2247#ifdef NEFORCE_STANDARD_14
2252template <typename Base, typename Derived>
2253NEFORCE_INLINE17 constexpr bool is_base_of_v = is_base_of<Base, Derived>::value;
2254#endif
2255
2256
2257#ifdef NEFORCE_STANDARD_20
2267template <typename T, typename Mem>
2268constexpr bool is_pointer_interconvertible_with_class(Mem T::* mp) noexcept {
2269 return __builtin_is_pointer_interconvertible_with_class(mp);
2270}
2271
2284template <typename S1, typename S2, typename M1, typename M2>
2285constexpr bool is_corresponding_member(M1 S1::* m1, M2 S2::* m2) noexcept {
2286 return __builtin_is_corresponding_member(m1, m2);
2287}
2288#endif
2289 // BaseTypeQualifierCheck
2291
2297
2308template <typename T>
2309struct is_trivial : bool_constant<__is_trivial(T)> {};
2310
2311#ifdef NEFORCE_STANDARD_14
2316template <typename T>
2317NEFORCE_INLINE17 constexpr bool is_trivial_v = is_trivial<T>::value;
2318#endif
2319
2320
2328template <typename T>
2329struct is_trivially_copyable : bool_constant<__is_trivially_copyable(T)> {};
2330
2331#ifdef NEFORCE_STANDARD_14
2336template <typename T>
2338#endif
2339
2340
2346template <typename T>
2347struct has_virtual_destructor : bool_constant<__has_virtual_destructor(T)> {};
2348
2349#ifdef NEFORCE_STANDARD_14
2354template <typename T>
2356#endif
2357
2358
2365template <typename T, typename... Args>
2366struct is_constructible : bool_constant<__is_constructible(T, Args...)> {};
2367
2368#ifdef NEFORCE_STANDARD_14
2373template <typename T, typename... Args>
2374NEFORCE_INLINE17 constexpr bool is_constructible_v = is_constructible<T, Args...>::value;
2375#endif
2376
2377
2383template <typename T>
2384struct is_copy_constructible : bool_constant<is_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2385
2386#ifdef NEFORCE_STANDARD_14
2391template <typename T>
2393#endif
2394
2395
2401template <typename T>
2402struct is_default_constructible : bool_constant<is_constructible<T>::value> {};
2403
2404#ifdef NEFORCE_STANDARD_14
2409template <typename T>
2411#endif
2412
2413
2415NEFORCE_BEGIN_INNER__
2416template <typename T>
2417void __implicitly_default_construct_aux(const T&) noexcept;
2418NEFORCE_END_INNER__
2420
2429template <typename T, typename Dummy = void>
2431
2433template <typename T>
2434struct is_implicitly_default_constructible<T, void_t<decltype(inner::__implicitly_default_construct_aux<T>({}))>>
2435: true_type {};
2437
2438#ifdef NEFORCE_STANDARD_14
2443template <typename T>
2445#endif
2446
2447
2453template <typename T>
2454struct is_move_constructible : bool_constant<is_constructible<T, T>::value> {};
2455
2456#ifdef NEFORCE_STANDARD_14
2461template <typename T>
2463#endif
2464
2465
2472template <typename To, typename From>
2473struct is_assignable : bool_constant<__is_assignable(To, From)> {};
2474
2475#ifdef NEFORCE_STANDARD_14
2480template <typename To, typename From>
2481NEFORCE_INLINE17 constexpr bool is_assignable_v = is_assignable<To, From>::value;
2482#endif
2483
2484
2492template <typename T>
2494: bool_constant<is_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2495
2496#ifdef NEFORCE_STANDARD_14
2501template <typename T>
2502NEFORCE_INLINE17 constexpr bool is_copy_assignable_v = is_copy_assignable<T>::value;
2503#endif
2504
2505
2513template <typename T>
2514struct is_move_assignable : bool_constant<is_assignable<add_lvalue_reference_t<T>, T>::value> {};
2515
2516#ifdef NEFORCE_STANDARD_14
2521template <typename T>
2522NEFORCE_INLINE17 constexpr bool is_move_assignable_v = is_move_assignable<T>::value;
2523#endif
2524
2525
2536template <typename T>
2538
2540#ifdef NEFORCE_COMPILER_MSVC
2541template <typename T>
2542struct is_destructible : bool_constant<__is_destructible(T)> {};
2543#else
2544NEFORCE_BEGIN_INNER__
2545template <typename T>
2546struct __destructible_aux {
2547private:
2548 template <typename T1, typename = decltype(declval<T1&>().~T1())>
2549 static true_type __test(int);
2550 template <typename>
2551 static false_type __test(...);
2552
2553public:
2554 using type = decltype(__test<T>(0));
2555};
2556
2557template <typename T, bool = disjunction<is_void<T>, is_unbounded_array<T>, is_function<T>>::value,
2558 bool = disjunction<is_reference<T>, is_scalar<T>>::value>
2559struct __is_destructible_dispatch;
2560
2561template <typename T>
2562struct __is_destructible_dispatch<T, false, false> : __destructible_aux<remove_all_extents_t<T>>::type {};
2563
2564template <typename T>
2565struct __is_destructible_dispatch<T, true, false> : false_type {};
2566
2567template <typename T>
2568struct __is_destructible_dispatch<T, false, true> : true_type {};
2569
2570NEFORCE_END_INNER__
2571
2572template <typename T>
2573struct is_destructible : inner::__is_destructible_dispatch<T>::type {};
2574#endif
2576
2577#ifdef NEFORCE_STANDARD_14
2582template <typename T>
2583NEFORCE_INLINE17 constexpr bool is_destructible_v = is_destructible<T>::value;
2584#endif
2585
2586
2595template <typename T, typename... Args>
2596struct is_trivially_constructible : bool_constant<__is_trivially_constructible(T, Args...)> {};
2597
2598#ifdef NEFORCE_STANDARD_14
2603template <typename T, typename... Args>
2604NEFORCE_INLINE17 constexpr bool is_trivially_constructible_v = is_trivially_constructible<T, Args...>::value;
2605#endif
2606
2607
2613template <typename T>
2615: bool_constant<is_trivially_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2616
2617#ifdef NEFORCE_STANDARD_14
2622template <typename T>
2624#endif
2625
2626
2632template <typename T>
2633struct is_trivially_default_constructible : bool_constant<is_trivially_constructible<T>::value> {};
2634
2635#ifdef NEFORCE_STANDARD_14
2640template <typename T>
2642#endif
2643
2644
2650template <typename T>
2651struct is_trivially_move_constructible : bool_constant<is_trivially_constructible<T, T>::value> {};
2652
2653#ifdef NEFORCE_STANDARD_14
2658template <typename T>
2660#endif
2661
2662
2669template <typename To, typename From>
2670struct is_trivially_assignable : bool_constant<__is_trivially_assignable(To, From)> {};
2671
2672#ifdef NEFORCE_STANDARD_14
2677template <typename To, typename From>
2679#endif
2680
2681
2687template <typename T>
2689: bool_constant<is_trivially_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2690
2691#ifdef NEFORCE_STANDARD_14
2696template <typename T>
2698#endif
2699
2700
2706template <typename T>
2707struct is_trivially_move_assignable : bool_constant<is_trivially_assignable<add_lvalue_reference_t<T>, T>::value> {};
2708
2709#ifdef NEFORCE_STANDARD_14
2714template <typename T>
2716#endif
2717
2718
2726template <typename T>
2728#if defined(NEFORCE_COMPILER_MSVC) || defined(NEFORCE_COMPILER_CLANG)
2729 bool_constant<__is_trivially_destructible(T)> {
2730};
2731#else
2732 conjunction<is_destructible<T>, bool_constant<__has_trivial_destructor(T)>> {
2733};
2734#endif
2735
2736#ifdef NEFORCE_STANDARD_14
2741template <typename T>
2743#endif
2744
2745
2752template <typename T, typename... Args>
2754
2760template <typename T>
2762
2764#ifdef NEFORCE_COMPILER_MSVC
2765template <typename T, typename... Args>
2766struct is_nothrow_constructible : bool_constant<__is_nothrow_constructible(T, Args...)> {};
2767#else
2768NEFORCE_BEGIN_INNER__
2769template <typename T, bool = is_array<T>::value>
2770struct __is_nothrow_default_constructible_dispatch;
2771
2772template <typename T>
2773struct __is_nothrow_default_constructible_dispatch<T, true>
2774: conjunction<is_bounded_array<T>, bool_constant<noexcept(remove_all_extents_t<T>())>> {};
2775
2776template <typename T>
2777struct __is_nothrow_default_constructible_dispatch<T, false> : bool_constant<noexcept(T())> {};
2778
2779NEFORCE_END_INNER__
2780
2781template <typename T>
2783: conjunction<is_default_constructible<T>, inner::__is_nothrow_default_constructible_dispatch<T>> {};
2784
2785NEFORCE_BEGIN_INNER__
2786
2787template <typename T, typename... Args>
2788struct __is_nothrow_constructible_dispatch : bool_constant<noexcept(T(_NEFORCE declval<Args>()...))> {};
2789
2790template <typename T>
2791struct __is_nothrow_constructible_dispatch<T> : is_nothrow_default_constructible<T> {};
2792
2793NEFORCE_END_INNER__
2794
2795template <typename T, typename... Args>
2797: conjunction<is_constructible<T, Args...>, inner::__is_nothrow_constructible_dispatch<T, Args...>> {};
2798#endif
2800
2801#ifdef NEFORCE_STANDARD_14
2806template <typename T, typename... Args>
2807NEFORCE_INLINE17 constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<T, Args...>::value;
2808#endif
2809
2810
2816template <typename T>
2818: bool_constant<is_nothrow_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2819
2820#ifdef NEFORCE_STANDARD_14
2825template <typename T>
2827#endif
2828
2829
2831#ifdef NEFORCE_COMPILER_MSVC
2832template <typename T>
2833struct is_nothrow_default_constructible : bool_constant<is_nothrow_constructible_v<T>> {};
2834#endif
2836
2837
2838#ifdef NEFORCE_STANDARD_14
2843template <typename T>
2845#endif
2846
2847
2853template <typename T>
2854struct is_nothrow_move_constructible : bool_constant<is_nothrow_constructible<T, T>::value> {};
2855
2856#ifdef NEFORCE_STANDARD_14
2861template <typename T>
2863#endif
2864
2865
2872template <typename To, typename From>
2874
2876template <typename To, typename From>
2877struct is_nothrow_assignable : bool_constant<__is_nothrow_assignable(To, From)> {};
2879
2880#ifdef NEFORCE_STANDARD_14
2885template <typename To, typename From>
2887#endif
2888
2889
2895template <typename T>
2897: bool_constant<is_nothrow_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2898
2899#ifdef NEFORCE_STANDARD_14
2904template <typename T>
2906#endif
2907
2908
2914template <typename T>
2915struct is_nothrow_move_assignable : bool_constant<is_nothrow_assignable<add_lvalue_reference_t<T>, T>::value> {};
2916
2917#ifdef NEFORCE_STANDARD_14
2922template <typename T>
2924#endif
2925
2926
2927#ifndef NEFORCE_COMPILER_MSVC
2929NEFORCE_BEGIN_INNER__
2930template <typename T>
2931struct __is_nothrow_destructible_aux {
2932private:
2933 template <typename T1>
2934 static bool_constant<noexcept(declval<T1&>().~T1())> __test(int);
2935
2936 template <typename>
2937 static false_type __test(...);
2938
2939public:
2940 using type = decltype(__test<T>(0));
2941};
2942
2943template <typename T, bool = disjunction<is_void<T>, is_unbounded_array<T>, is_function<T>>::value,
2944 bool = disjunction<is_reference<T>, is_scalar<T>>::value>
2945struct __is_nothrow_destructible_dispatch;
2946
2947template <typename T>
2948struct __is_nothrow_destructible_dispatch<T, false, false>
2949: __is_nothrow_destructible_aux<remove_all_extents_t<T>>::type {};
2950
2951template <typename T>
2952struct __is_nothrow_destructible_dispatch<T, true, false> : false_type {};
2953
2954template <typename T>
2955struct __is_nothrow_destructible_dispatch<T, false, true> : true_type {};
2956NEFORCE_END_INNER__
2958#endif
2959
2960
2966template <typename T>
2968
2970template <typename T>
2972#ifdef NEFORCE_COMPILER_MSVC
2973 bool_constant<__is_nothrow_destructible(T)> {
2974};
2975#else
2976 inner::__is_nothrow_destructible_dispatch<T>::type {
2977};
2978#endif
2980
2981#ifdef NEFORCE_STANDARD_14
2986template <typename T>
2988#endif
2989
2990
2999template <typename T>
3001
3002#ifdef NEFORCE_STANDARD_14
3007template <typename T>
3009#endif
3010 // TypeSpecialMemberFunctionChecks
3012
3018
3027template <typename T>
3028NEFORCE_NODISCARD constexpr T&& forward(remove_reference_t<T>& x) noexcept {
3029 return static_cast<T&&>(x);
3030}
3031
3041template <typename T>
3042NEFORCE_NODISCARD constexpr T&& forward(remove_reference_t<T>&& x) noexcept {
3043 static_assert(!is_lvalue_reference<T>::value, "forward failed.");
3044 return static_cast<T&&>(x);
3045}
3046
3055template <typename T>
3056NEFORCE_NODISCARD constexpr remove_reference_t<T>&& move(T&& x) noexcept {
3057 return static_cast<remove_reference_t<T>&&>(x);
3058}
3059
3068template <typename T>
3070 const T&, T&&>
3071move_if_noexcept(T& x) noexcept {
3072 return _NEFORCE move(x);
3073}
3074
3083template <typename T>
3084NEFORCE_NODISCARD constexpr T* addressof(T& x) noexcept {
3085 return __builtin_addressof(x);
3086}
3087
3093template <typename T>
3094const T* addressof(const T&&) = delete;
3095
3096
3097template <typename T, typename U>
3098constexpr size_t offset_of(U T::* member) {
3099 return reinterpret_cast<size_t>(&(reinterpret_cast<T const volatile*>(nullptr)->*member));
3100}
3101
3102 // ArgsForwardFunctions
3104
3110
3111#if !defined(NEFORCE_COMPILER_MSVC) && !defined(NEFORCE_COMPILER_CLANG)
3113NEFORCE_BEGIN_INNER__
3114template <typename From, typename To, bool = disjunction_v<is_void<From>, is_function<To>, is_array<To>>>
3115struct __is_convertible_helper {
3116 using type = typename is_void<To>::type;
3117};
3118
3119template <typename From, typename To>
3120struct __is_convertible_helper<From, To, false> {
3121private:
3122 template <typename From1, typename To1, typename = decltype(_NEFORCE declvoid<To1>(_NEFORCE declval<From1>()))>
3123 static true_type __test(int);
3124
3125 template <typename, typename>
3126 static false_type __test(...);
3127
3128public:
3129 using type = decltype(__test<From, To>(0));
3130};
3131NEFORCE_END_INNER__
3133#endif
3134
3141template <typename From, typename To>
3143#if defined(NEFORCE_COMPILER_MSVC)
3144 bool_constant<__is_convertible_to(From, To)> {
3145};
3146#elif defined(NEFORCE_COMPILER_CLANG)
3147 bool_constant<__is_convertible(From, To)> {
3148};
3149#else
3150 inner::__is_convertible_helper<From, To>::type {
3151};
3152#endif
3153
3154#ifdef NEFORCE_STANDARD_14
3159template <typename From, typename To>
3160NEFORCE_INLINE17 constexpr bool is_convertible_v = is_convertible<From, To>::value;
3161#endif
3162
3163#if defined(NEFORCE_STANDARD_20) || defined(NEXUSFORCE_ENABLE_DOXYGEN)
3170template <typename From, typename To>
3171concept convertible_to = is_convertible_v<From, To> && requires { static_cast<To>(_NEFORCE declval<From>()); };
3172#endif // NEFORCE_STANDARD_20
3173
3174
3183template <typename ToElement, typename FromElement>
3184using is_array_convertible = is_convertible<FromElement (*)[], ToElement (*)[]>;
3185
3186#ifdef NEFORCE_STANDARD_14
3191template <typename ToElement, typename FromElement>
3193#endif
3194
3195
3204template <typename From, typename To, bool IsConvertible = is_convertible<From, To>::value,
3205 bool IsVoid = is_void<To>::value>
3206struct is_nothrow_convertible : bool_constant<noexcept(_NEFORCE declcopy<To>(_NEFORCE declval<From>()))> {};
3207
3209template <typename From, typename To, bool IsVoid>
3210struct is_nothrow_convertible<From, To, false, IsVoid> : false_type {};
3211
3212template <typename From, typename To>
3213struct is_nothrow_convertible<From, To, true, true> : true_type {};
3215
3216#ifdef NEFORCE_STANDARD_14
3221template <typename From, typename To>
3223#endif
3224
3225
3233template <typename Iterator, typename Ptr, bool IsPtr = is_pointer<remove_cvref_t<Iterator>>::value>
3234struct is_nothrow_arrow : bool_constant<is_nothrow_convertible<Iterator, Ptr>::value> {};
3235
3237template <typename Iterator, typename Ptr>
3238struct is_nothrow_arrow<Iterator, Ptr, false>
3239: bool_constant<noexcept(_NEFORCE declcopy<Ptr>(_NEFORCE declval<Iterator>().operator->()))> {};
3241
3242#ifdef NEFORCE_STANDARD_14
3247template <typename Iterator, typename Ptr>
3249#endif
3250 // ConvertibleChecks
3252
3258
3260NEFORCE_BEGIN_INNER__
3261template <size_t>
3262struct __sign_byte_aux;
3263
3264template <>
3265struct __sign_byte_aux<1> {
3266 template <typename>
3267 using signed_t = signed char;
3268 template <typename>
3269 using unsigned_t = unsigned char;
3270};
3271template <>
3272struct __sign_byte_aux<2> {
3273 template <typename>
3274 using signed_t = signed short;
3275 template <typename>
3276 using unsigned_t = unsigned short;
3277};
3278template <>
3279struct __sign_byte_aux<4> {
3280#ifdef NEFORCE_PLATFORM_WINDOWS
3281 template <typename T>
3282 using signed_t = conditional_t<is_same_v<T, signed long> || is_same_v<T, unsigned long>, signed long, signed int>;
3283
3284 template <typename T>
3285 using unsigned_t =
3287#else
3288 template <typename>
3289 using signed_t = signed int;
3290 template <typename>
3291 using unsigned_t = unsigned int;
3292#endif
3293};
3294template <>
3295struct __sign_byte_aux<8> {
3296#ifdef NEFORCE_PLATFORM_WINDOWS
3297 template <typename>
3298 using signed_t = signed long long;
3299 template <typename>
3300 using unsigned_t = unsigned long long;
3301#else
3302 template <typename T>
3303 using signed_t = conditional_t<is_same<T, signed long>::value || is_same<T, unsigned long>::value, signed long,
3304 signed long long>;
3305
3306 template <typename T>
3307 using unsigned_t = conditional_t<is_same<T, signed long>::value || is_same<T, unsigned long>::value, unsigned long,
3308 unsigned long long>;
3309#endif
3310};
3311#if defined(NEFORCE_COMPILER_GNUC) && defined(__SIZEOF_INT128__)
3312template <>
3313struct __sign_byte_aux<16> {
3314 template <typename>
3315 using signed_t = signed __int128;
3316 template <typename>
3317 using unsigned_t = unsigned __int128;
3318};
3319#endif
3320NEFORCE_END_INNER__
3322
3330template <typename T>
3332 using type = copy_cv_t<T, typename inner::__sign_byte_aux<sizeof(T)>::template signed_t<T>>;
3333};
3334
3339template <typename T>
3340using make_signed_t = typename make_signed<T>::type;
3341
3349template <typename T>
3351 using type = copy_cv_t<T, typename inner::__sign_byte_aux<sizeof(T)>::template unsigned_t<T>>;
3352};
3353
3358template <typename T>
3359using make_unsigned_t = typename make_unsigned<T>::type;
3360
3361
3363NEFORCE_BEGIN_INNER__
3364template <size_t Size, bool IsSigned>
3365struct __make_integer_impl;
3366
3367template <size_t Size>
3368struct __make_integer_impl<Size, true> {
3369 using type = typename __sign_byte_aux<Size>::template signed_t<int>;
3370};
3371
3372template <size_t Size>
3373struct __make_integer_impl<Size, false> {
3374 using type = typename __sign_byte_aux<Size>::template unsigned_t<int>;
3375};
3376NEFORCE_END_INNER__
3378
3385template <size_t Size, bool IsSigned = true>
3387 using type = typename inner::__make_integer_impl<Size, IsSigned>::type;
3388};
3389
3394template <size_t Size, bool IsSigned = true>
3395using make_integer_t = typename make_integer<Size, IsSigned>::type;
3396
3397
3403template <size_t... Values>
3405
3407template <size_t Value>
3408struct max_value<Value> : integral_constant<size_t, Value> {};
3409
3410template <size_t First, size_t Second, size_t... Rest>
3411struct max_value<First, Second, Rest...> : max_value<(First > Second ? First : Second), Rest...> {};
3413
3414#ifdef NEFORCE_STANDARD_14
3415template <size_t... Values>
3416NEFORCE_INLINE17 constexpr size_t max_value_v = max_value<Values...>::value;
3417#endif
3418 // SignManipulation
3420
3426
3432template <typename T>
3433struct alignment_of : integral_constant<size_t, alignof(T)> {};
3434
3435#ifdef NEFORCE_STANDARD_14
3440template <typename T>
3442#endif
3443
3444
3451template <size_t Len, size_t Align = alignof(_NEFORCE max_align_t)>
3453 static_assert((Align & (Align - 1)) == 0, "Alignment must be power of two");
3454
3459 struct alignas(Align) type {
3461 };
3462};
3463
3468template <size_t Len, size_t Align = alignof(_NEFORCE max_align_t)>
3470
3471
3480template <size_t Len, typename... Types>
3482private:
3483 static constexpr size_t required_alignment = max_value<alignof(Types)...>::value;
3484 static constexpr size_t required_size = max_value<sizeof(Types)...>::value;
3485 static constexpr size_t storage_size = (Len > required_size) ? Len : required_size;
3486
3487 static_assert((required_alignment & (required_alignment - 1)) == 0, "Alignment must be power of two");
3488
3489public:
3493 static constexpr size_t alignment_value = required_alignment;
3497 static constexpr size_t size_value = storage_size;
3498
3503 struct alignas(alignment_value) type {
3504 byte_t data[storage_size];
3505 };
3506
3517 template <typename T>
3518 static constexpr bool is_storable() noexcept {
3519 return is_trivially_copyable<T>::value && sizeof(T) <= storage_size && alignof(T) <= alignment_value;
3520 }
3521};
3522
3527template <size_t Len, typename... Types>
3528using aligned_union_t = typename aligned_union<Len, Types...>::type;
3529
3530#ifdef NEFORCE_STANDARD_14
3535template <size_t Len, typename... Types>
3536constexpr size_t aligned_union_v = aligned_union<Len, Types...>::align_value;
3537#endif
3538 // Alignment
3540
3546
3557template <typename T>
3558struct decay {
3559private:
3560 using remove_ref_t = remove_reference_t<T>;
3561 using check_func_t =
3563
3564public:
3565 using type =
3567};
3568
3573template <typename T>
3574using decay_t = typename decay<T>::type;
3575
3576
3578NEFORCE_BEGIN_INNER__
3579template <typename Default, typename, template <typename...> class, typename...>
3580struct __detector {
3581 using value_t = false_type;
3582 using type = Default;
3583};
3584template <typename Default, template <typename...> class Op, typename... Args>
3585struct __detector<Default, void_t<Op<Args...>>, Op, Args...> {
3586 using value_t = true_type;
3587 using type = Op<Args...>;
3588};
3589NEFORCE_END_INNER__
3591
3599template <typename Default, template <typename...> class Op, typename... Args>
3600using detected_or = inner::__detector<Default, void, Op, Args...>;
3601
3606template <typename Default, template <typename...> class Op, typename... Args>
3607using detected_or_t = typename detected_or<Default, Op, Args...>::type;
3608
3609
3621template <typename T1, typename T2>
3622using common_ternary_operator_t = decltype(true ? _NEFORCE declval<T1>() : _NEFORCE declval<T2>());
3623
3624
3626NEFORCE_BEGIN_INNER__
3627template <typename, typename, typename = void>
3628struct __oper_decay_aux {};
3629template <typename T1, typename T2>
3630struct __oper_decay_aux<T1, T2, void_t<common_ternary_operator_t<decay_t<T1>, decay_t<T2>>>> {
3632};
3633NEFORCE_END_INNER__
3635
3641template <typename... Types>
3643
3648template <typename... Types>
3649using common_type_t = typename common_type<Types...>::type;
3650
3652template <>
3653struct common_type<> {};
3654
3655template <typename T1>
3656struct common_type<T1> : common_type<T1, T1> {};
3657
3658template <typename T1, typename T2>
3659struct common_type<T1, T2> : inner::__oper_decay_aux<T1, T2> {};
3660
3661template <typename T1, typename T2, typename... Rest>
3662struct common_type<T1, T2, Rest...> : common_type<common_type_t<T1, T2>, Rest...> {};
3664
3665
3666#ifdef NEFORCE_STANDARD_20
3667
3673template <typename... Types>
3675
3680template <typename... Types>
3681using common_reference_t = typename common_reference<Types...>::type;
3682
3684
3685template <>
3686struct common_reference<> {};
3687
3688template <typename T>
3689struct common_reference<T> {
3690 using type = T;
3691};
3692
3693
3694NEFORCE_BEGIN_INNER__
3695
3696template <typename T1, typename T2>
3697struct __common_reference_base_aux : common_type<T1, T2> {};
3698
3699template <typename T1, typename T2>
3700 requires requires { typename _NEFORCE common_ternary_operator_t<T1, T2>; }
3701struct __common_reference_base_aux<T1, T2> {
3702 using type = _NEFORCE common_ternary_operator_t<T1, T2>;
3703};
3704
3705template <typename, typename, template <typename> typename, template <typename> typename>
3706struct __basic_common_reference {};
3707
3708template <typename T1>
3709struct __add_qualifier_aux {
3710 template <typename T2>
3711 using apply_t = copy_ref_t<T1, copy_cv_t<T1, T2>>;
3712};
3713
3714template <typename T1, typename T2>
3715using qualifier_extract = typename __basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>,
3716 __add_qualifier_aux<T1>::template apply_t,
3717 __add_qualifier_aux<T2>::template apply_t>::type;
3718
3719template <typename T1, typename T2>
3720struct __common_ref_qualify_aux : __common_reference_base_aux<T1, T2> {};
3721
3722template <typename T1, typename T2>
3723 requires requires { typename qualifier_extract<T1, T2>; }
3724struct __common_ref_qualify_aux<T1, T2> {
3725 using type = qualifier_extract<T1, T2>;
3726};
3727
3728template <typename T1, typename T2>
3729struct __common_reference_ptr_aux : __common_ref_qualify_aux<T1, T2> {};
3730
3731template <typename T1, typename T2>
3734
3735template <typename, typename>
3736struct __common_reference_aux {};
3737
3738template <typename T1, typename T2>
3739 requires requires { typename __common_lvalue_aux<T1, T2>; }
3740struct __common_reference_aux<T1&, T2&> {
3741 using type = __common_lvalue_aux<T1, T2>;
3742};
3743
3744template <typename T1, typename T2>
3746struct __common_reference_aux<T1&&, T2&> {
3747 using type = __common_lvalue_aux<const T1, T2>;
3748};
3749
3750template <typename T1, typename T2>
3752struct __common_reference_aux<T1&, T2&&> {
3753 using type = __common_lvalue_aux<const T2, T1>;
3754};
3755
3756template <typename T1, typename T2>
3757using __common_rvalue_aux = remove_reference_t<__common_lvalue_aux<T1, T2>>&&;
3758
3759template <typename T1, typename T2>
3761struct __common_reference_aux<T1&&, T2&&> {
3762 using type = __common_rvalue_aux<T1, T2>;
3763};
3764
3765template <typename T1, typename T2>
3766using __common_reference_aux_t = typename __common_reference_aux<T1, T2>::type;
3767
3768template <typename T1, typename T2>
3771struct __common_reference_ptr_aux<T1, T2> {
3772 using type = __common_reference_aux_t<T1, T2>;
3773};
3774
3775NEFORCE_END_INNER__
3776
3777
3778template <typename T1, typename T2>
3779struct common_reference<T1, T2> : inner::__common_reference_ptr_aux<T1, T2> {};
3780
3781template <typename T1, typename T2, typename T3, typename... Rest>
3782struct common_reference<T1, T2, T3, Rest...> {};
3783
3784template <typename T1, typename T2, typename T3, typename... Rest>
3785 requires requires { typename common_reference_t<T1, T2>; }
3786struct common_reference<T1, T2, T3, Rest...> : common_reference<common_reference_t<T1, T2>, T3, Rest...> {};
3787
3789#endif
3790
3791
3800template <typename T, template <typename...> class Template>
3802
3804template <template <typename...> class Template, typename... Args>
3805struct is_specialization<Template<Args...>, Template> : true_type {};
3807
3808#ifdef NEFORCE_STANDARD_17
3813template <typename T, template <typename...> class Template>
3815#else
3822template <typename T, template <typename...> class Template>
3823constexpr bool is_specialization_v() {
3825}
3826#endif
3827 // TypeAttributeOperations
3829
3835
3836template <typename>
3837struct is_swappable;
3838
3839template <typename>
3840struct is_nothrow_swappable;
3841
3842
3849template <typename T>
3852
3860template <typename T, size_t Size>
3861NEFORCE_CONSTEXPR14 enable_if_t<is_swappable<T>::value> swap(T (&lhs)[Size],
3862 T (&rhs)[Size]) noexcept(is_nothrow_swappable<T>::value);
3863
3867void swap() = delete;
3868
3877template <typename T, typename U = T>
3878NEFORCE_CONSTEXPR14 T exchange(T& val, U&& new_val) noexcept(is_nothrow_move_constructible_v<T> &&
3880
3881
3889template <typename T1, typename T2, typename Dummy = void>
3891
3893template <typename T1, typename T2>
3894struct is_swappable_from<T1, T2, void_t<decltype(_NEFORCE swap(_NEFORCE declval<T1>(), _NEFORCE declval<T2>()))>>
3895: true_type {};
3897
3898
3907template <typename T1, typename T2>
3908struct is_swappable_with : bool_constant<conjunction<is_swappable_from<T1, T2>, is_swappable_from<T2, T1>>::value> {};
3909
3910
3916template <typename T>
3917struct is_swappable : bool_constant<is_swappable_with<add_lvalue_reference_t<T>, add_lvalue_reference_t<T>>::value> {};
3918
3919#ifdef NEFORCE_STANDARD_14
3924template <typename T>
3925NEFORCE_INLINE17 constexpr bool is_swappable_v = is_swappable<T>::value;
3926#endif
3927
3928
3935template <typename T1, typename T2>
3937: bool_constant<noexcept(_NEFORCE swap(_NEFORCE declval<T1>(), _NEFORCE declval<T2>())) &&
3938 noexcept(_NEFORCE swap(_NEFORCE declval<T2>(), _NEFORCE declval<T1>()))> {};
3939
3940
3947template <typename T1, typename T2>
3949: bool_constant<conjunction<is_swappable_with<T1, T2>, is_nothrow_swappable_from<T1, T2>>::value> {};
3950
3951
3957template <typename T>
3959: bool_constant<is_nothrow_swappable_with<add_lvalue_reference_t<T>, add_lvalue_reference_t<T>>::value> {};
3960
3961#ifdef NEFORCE_STANDARD_14
3966template <typename T>
3968#endif
3969
3970
3981template <typename T, typename Dummy = void>
3983
3985template <typename T>
3986struct is_ADL_swappable<T, void_t<decltype(swap(_NEFORCE declval<T&>(), _NEFORCE declval<T&>()))>> : true_type {};
3988
3989
4001template <typename T>
4003: bool_constant<conjunction<is_trivially_destructible<T>, is_trivially_move_constructible<T>,
4004 is_trivially_move_assignable<T>, negation<is_ADL_swappable<T>>>::value> {};
4005
4006#ifdef NEFORCE_STANDARD_14
4011template <typename T>
4013#endif
4014
4016
4017template <typename T>
4020 T tmp = _NEFORCE move(lhs);
4021 lhs = _NEFORCE move(rhs);
4022 rhs = _NEFORCE move(tmp);
4023 return;
4024}
4025
4026template <typename T, size_t Size>
4027NEFORCE_CONSTEXPR14 enable_if_t<is_swappable<T>::value> swap(T (&lhs)[Size],
4028 T (&rhs)[Size]) noexcept(is_nothrow_swappable<T>::value) {
4029 if (&lhs == &rhs) {
4030 return;
4031 }
4032 T* first1 = lhs;
4033 T* last1 = first1 + Size;
4034 T* first2 = rhs;
4035 for (; first1 != last1; ++first1, ++first2) {
4036 _NEFORCE swap(*first1, *first2);
4037 }
4038 return;
4039}
4040
4041template <typename T, typename U>
4042NEFORCE_CONSTEXPR14 T exchange(T& val, U&& new_val) noexcept(is_nothrow_move_constructible_v<T> &&
4044 T old_val = _NEFORCE move(val);
4045 val = _NEFORCE forward<U>(new_val);
4046 return old_val;
4047}
4048
4050 // SwapUtility
4052
4058
4059#ifdef NEFORCE_STANDARD_20
4069template <typename T>
4070concept is_pair_v = requires(T p) {
4071 typename T::first_type;
4072 typename T::second_type;
4073 p.first;
4074 p.second;
4075};
4076#endif // NEFORCE_STANDARD_20
4077
4078
4089template <typename Alloc, typename Dummy = void>
4091
4093template <typename Alloc>
4094struct is_allocator<Alloc, void_t<typename Alloc::value_type, decltype(declval<Alloc&>().allocate(size_t{}))>>
4095: true_type {};
4097
4098#ifdef NEFORCE_STANDARD_14
4103template <typename Alloc>
4104NEFORCE_INLINE17 constexpr bool is_allocator_v = is_allocator<Alloc>::value;
4105#endif
4106
4107
4109NEFORCE_BEGIN_INNER__
4110template <typename T>
4111struct __has_valid_begin_end {
4112private:
4113 template <typename U>
4114 static auto __test(int)
4115 -> decltype(declval<U>().begin(), declval<U>().end(),
4116 is_same<decltype(declval<U>().begin()), decltype(declval<U>().end())>(), true_type{});
4117
4118 template <typename U>
4119 static false_type __test(...);
4120
4121public:
4122 static constexpr bool value = decltype(__test<T>(0))::value;
4123};
4124NEFORCE_END_INNER__
4126
4127
4133template <typename Iterator>
4135private:
4136 template <typename U>
4137 static auto __test(int) -> decltype(++declval<U&>(), true_type{});
4138
4139 template <typename U>
4140 static false_type __test(...);
4141
4142public:
4143 static constexpr bool value = decltype(__test<Iterator>(0))::value;
4144};
4145
4146#ifdef NEFORCE_STANDARD_14
4151template <typename Iterator>
4152NEFORCE_INLINE17 constexpr bool is_incrementible_v = is_incrementible<Iterator>::value;
4153#endif
4154
4155
4161template <typename Iterator>
4163private:
4164 template <typename U>
4165 static auto __test(int) -> decltype(--declval<U&>(), true_type{});
4166
4167 template <typename U>
4168 static false_type __test(...);
4169
4170public:
4171 static constexpr bool value = decltype(__test<Iterator>(0))::value;
4172};
4173
4174#ifdef NEFORCE_STANDARD_14
4179template <typename Iterator>
4180NEFORCE_INLINE17 constexpr bool is_decrementible_v = is_decrementible<Iterator>::value;
4181#endif
4182
4183
4193template <typename Container>
4194struct is_iterable : bool_constant<inner::__has_valid_begin_end<Container>::value &&
4195 is_incrementible<decltype(declval<Container>().begin())>::value> {};
4196
4197#ifdef NEFORCE_STANDARD_14
4202template <typename T>
4203NEFORCE_INLINE17 constexpr bool is_iterable_v = is_iterable<T>::value;
4204#endif
4205
4206
4208NEFORCE_BEGIN_INNER__
4209template <typename T>
4210struct __has_first_and_second {
4211private:
4212 template <typename U>
4213 static auto __test(int) -> decltype(declval<U>().first, declval<U>().second, true_type{});
4214
4215 template <typename U>
4216 static false_type __test(...);
4217
4218public:
4219 static constexpr bool value = decltype(__test<T>(0))::value;
4220};
4221NEFORCE_END_INNER__
4223
4233template <typename Map>
4235: bool_constant<is_iterable<Map>::value &&
4236 inner::__has_first_and_second<decltype(*declval<decltype(declval<Map>().begin())>())>::value> {};
4237
4238#ifdef NEFORCE_STANDARD_14
4243template <typename Map>
4244NEFORCE_INLINE17 constexpr bool is_maplike_v = is_maplike<Map>::value;
4245#endif
4246
4247
4249NEFORCE_BEGIN_INNER__
4250template <typename Alloc, typename T, typename... Args>
4251struct __has_construct_impl {
4252private:
4253 template <typename Alloc1, typename = decltype(_NEFORCE declval<Alloc1*>()->construct(_NEFORCE declval<T*>(),
4254 _NEFORCE declval<Args>()...))>
4255 static true_type __test(int);
4256
4257 template <typename>
4258 static false_type __test(...);
4259
4260public:
4261 using type = decltype(__test<Alloc>(0));
4262};
4263NEFORCE_END_INNER__
4265
4273template <typename Alloc, typename T, typename... Args>
4274struct has_construct : inner::__has_construct_impl<Alloc, T, Args...>::type {};
4275
4276#ifdef NEFORCE_STANDARD_14
4281template <typename Alloc, typename T, typename... Args>
4282NEFORCE_INLINE17 constexpr bool has_construct_v = has_construct<Alloc, T, Args...>::value;
4283#endif
4284
4285
4287NEFORCE_BEGIN_INNER__
4288template <typename T>
4289struct __has_base_impl {
4290private:
4291 template <typename U>
4292 static auto __test(int) -> decltype(_NEFORCE declval<const U>().base(), true_type{});
4293
4294 template <typename U>
4295 static false_type __test(...);
4296
4297public:
4298 static constexpr bool value = decltype(__test<T>(0))::value;
4299};
4300NEFORCE_END_INNER__
4302
4308template <typename T>
4309struct has_base : bool_constant<inner::__has_base_impl<T>::value> {};
4310
4311#ifdef NEFORCE_STANDARD_14
4316template <typename T>
4317NEFORCE_INLINE17 constexpr bool has_base_v = has_base<T>::value;
4318#endif
4319 // TypeActionCheck
4321
4327
4338template <typename T>
4339NEFORCE_ALWAYS_INLINE constexpr T initialize() noexcept(is_nothrow_default_constructible<T>::value) {
4340 static_assert(is_default_constructible<T>::value, "T must be default constructible");
4341 return T();
4342}
4343
4344#define __NEFORCE_INITIALIZE_BASIC_FUNCTION(OPT) \
4345 template <> \
4346 NEFORCE_ALWAYS_INLINE constexpr OPT initialize() noexcept { \
4347 return static_cast<OPT>(0); \
4348 }
4349
4350NEFORCE_MACRO_RANGE_ARITHMETIC(__NEFORCE_INITIALIZE_BASIC_FUNCTION)
4351#undef __NEFORCE_INITIALIZE_BASIC_FUNCTION
4352 // TypeInitializeFunction
4354 // TypeTraits
4356
4357NEFORCE_END_NAMESPACE__
4358#endif // NEFORCE_CORE_TYPEINFO_TYPE_TRAITS_HPP__
检查类型From是否可以转换为类型To
检查类型是否具有类似pair的结构
typename add_volatile< T >::type add_volatile_t
add_volatile的便捷别名
constexpr add_const_t< T > & as_const(T &val) noexcept
将值转换为const引用
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的便捷变量模板
constexpr remove_reference_t< T > && move(T &&x) noexcept
无条件转换为右值引用
constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
constexpr conditional_t<!is_nothrow_move_constructible< T >::value &&is_copy_constructible< T >::value, const T &, T && > move_if_noexcept(T &x) noexcept
在安全的情况下执行移动操作
constexpr T * addressof(T &x) noexcept
获取对象的地址
constexpr size_t rank_v
rank的便捷变量模板
constexpr size_t extent_v
extent的便捷变量模板
constexpr bool is_signed_v
is_signed的便捷变量模板
typename unpackage< T >::type unpackage_t
unpackage的便捷别名
constexpr bool is_character_v
is_character的便捷变量模板
constexpr bool is_integral_v
is_integral的便捷变量模板
constexpr bool is_boolean_v
is_boolean的便捷变量模板
constexpr bool is_void_v
is_void的便捷变量模板
constexpr bool is_floating_point_v
is_floating_point的便捷变量模板
constexpr bool is_packaged_v
is_packaged的便捷变量模板
unpackage_t< remove_cvref_t< T > > unpack_remove_cvref_t
同时解包并移除cv和引用限定符
constexpr bool is_arithmetic_v
is_arithmetic的便捷变量模板
constexpr bool is_unsigned_v
is_unsigned的便捷变量模板
typename package< T >::type package_t
package的便捷别名
constexpr bool is_standard_integral_v
is_standard_integral的便捷变量模板
constexpr bool is_unpackaged_v
is_unpackaged的便捷变量模板
constexpr bool is_scalar_v
is_scalar的便捷变量模板
constexpr bool is_base_of_v
is_base_of的便捷变量模板
constexpr bool is_lvalue_reference_v
is_lvalue_reference的便捷变量模板
constexpr bool is_const_v
is_const的便捷变量模板
constexpr bool is_abstract_v
is_abstract的便捷变量模板
typename underlying_type< T >::type underlying_type_t
underlying_type的便捷别名
constexpr bool is_member_function_pointer_v
is_member_function_pointer的便捷变量模板
constexpr bool is_null_pointer_v
is_null_pointer的便捷变量模板
constexpr bool is_integral_like_v
is_integral_like的便捷变量模板
constexpr bool is_pod_v
is_pod的便捷变量模板
constexpr bool is_pointer_interconvertible_with_class(Mem T::*mp) noexcept
判断成员指针是否指向类对象的起始位置
constexpr bool is_union_v
is_union的便捷变量模板
constexpr bool is_corresponding_member(M1 S1::*m1, M2 S2::*m2) noexcept
判断两个成员指针是否指向对应位置的成员
constexpr bool is_enum_v
is_enum的便捷变量模板
constexpr bool has_unique_object_representations_v
has_unique_object_representations的便捷变量模板
constexpr bool is_pointer_interconvertible_base_of_v
is_pointer_interconvertible_base_of的便捷变量模板
constexpr bool is_pointer_v
is_pointer的便捷变量模板
constexpr bool is_cstring_v
is_cstring的便捷变量模板
constexpr bool is_unbounded_array_v
is_unbounded_array的便捷变量模板
constexpr bool is_object_v
is_object的便捷变量模板
constexpr bool is_polymorphic_v
is_polymorphic的便捷变量模板
constexpr bool is_bounded_array_v
is_bounded_array的便捷变量模板
constexpr bool is_reference_v
is_reference的便捷变量模板
constexpr bool is_member_object_pointer_v
is_member_object_pointer的便捷变量模板
constexpr bool is_standard_layout_v
is_standard_layout的便捷变量模板
constexpr bool is_array_v
is_array的便捷变量模板
constexpr bool is_member_pointer_v
is_member_pointer的便捷变量模板
constexpr bool is_empty_v
is_empty的便捷变量模板
constexpr bool is_final_v
is_final的便捷变量模板
constexpr bool is_compound_v
is_compound的便捷变量模板
constexpr bool is_allocable_v
is_allocable的便捷变量模板
constexpr bool is_function_v
is_function的便捷变量模板
constexpr bool is_class_v
is_class的便捷变量模板
constexpr bool is_layout_compatible_v
is_layout_compatible的便捷变量模板
constexpr bool is_aggregate_v
is_aggregate的便捷变量模板
constexpr bool is_rvalue_reference_v
is_rvalue_reference的便捷变量模板
constexpr bool is_fundamental_v
is_fundamental的便捷变量模板
constexpr bool is_volatile_v
is_volatile的便捷变量模板
constexpr bool is_nothrow_arrow_v
is_nothrow_arrow的便捷变量模板
is_convertible< FromElement(*)[], ToElement(*)[]> is_array_convertible
判断数组元素类型FromElement是否可以转换为ToElement
constexpr bool is_array_convertible_v
is_array_convertible的便捷变量模板
constexpr bool is_convertible_v
is_convertible的便捷变量模板
constexpr bool is_nothrow_convertible_v
is_nothrow_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的便捷别名
constexpr bool is_swappable_v
is_swappable的便捷变量模板
void swap()=delete
删除无参数的swap重载
constexpr T exchange(T &val, U &&new_val) noexcept(is_nothrow_move_constructible_v< T > &&is_nothrow_assignable_v< T &, U >)
将新值赋给对象并返回旧值
constexpr bool is_trivially_swappable_v
is_trivially_swappable的便捷变量模板
constexpr bool is_nothrow_swappable_v
is_nothrow_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的便捷别名
constexpr bool is_incrementible_v
iis_incrementible的便捷变量模板
constexpr bool is_allocator_v
is_allocator的便捷变量模板
constexpr bool has_base_v
has_base的便捷变量模板
constexpr bool has_construct_v
has_construct的便捷变量模板
constexpr bool is_decrementible_v
is_decrementible的便捷变量模板
constexpr bool is_iterable_v
is_iterable的便捷变量模板
constexpr bool is_maplike_v
is_maplike的便捷变量模板
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类型
constexpr decltype(auto) end(Container &cont) noexcept(noexcept(cont.end()))
获取容器的结束迭代器
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)
所有算术类型列表宏
constexpr bool is_copy_constructible_v
is_copy_constructible的便捷变量模板
constexpr bool is_constructible_v
is_constructible的便捷变量模板
constexpr bool is_nothrow_copy_constructible_v
is_nothrow_copy_constructible的便捷变量模板
constexpr bool is_nothrow_default_constructible_v
is_nothrow_default_constructible的便捷变量模板
constexpr bool is_trivial_v
is_trivial的便捷变量模板
constexpr bool is_nothrow_copy_assignable_v
is_nothrow_copy_assignable的便捷变量模板
constexpr bool is_nothrow_move_constructible_v
is_nothrow_move_constructible的便捷变量模板
constexpr bool is_trivially_constructible_v
is_trivially_constructible的便捷变量模板
constexpr bool is_trivially_assignable_v
is_trivially_assignable的便捷变量模板
constexpr bool is_move_constructible_v
is_move_constructible的便捷变量模板
constexpr bool is_trivially_move_assignable_v
is_trivially_move_assignable的便捷变量模板
constexpr bool is_trivially_copy_assignable_v
is_trivially_copy_assignable的便捷变量模板
constexpr bool is_default_constructible_v
is_default_constructible的便捷变量模板
constexpr bool has_virtual_destructor_v
has_virtual_destructor的便捷变量模板
constexpr bool is_implicitly_default_constructible_v
is_implicitly_default_constructible的便捷变量模板
constexpr bool is_trivially_destructible_v
is_trivially_destructible的便捷变量模板
constexpr bool is_assignable_v
is_assignable的便捷变量模板
constexpr bool is_location_invariant_v
is_location_invariant的便捷变量模板
constexpr bool is_destructible_v
is_destructible的便捷变量模板
constexpr bool is_trivially_copy_constructible_v
is_trivially_copy_constructible的便捷变量模板
constexpr bool is_trivially_move_constructible_v
is_trivially_move_constructible的便捷变量模板
constexpr bool is_trivially_default_constructible_v
is_trivially_default_constructible的便捷变量模板
constexpr bool is_nothrow_constructible_v
is_nothrow_constructible的便捷变量模板
constexpr bool is_nothrow_assignable_v
is_nothrow_assignable的便捷变量模板
constexpr bool is_nothrow_move_assignable_v
is_nothrow_move_assignable的便捷变量模板
constexpr bool is_nothrow_destructible_v
is_nothrow_destructible的便捷变量模板
constexpr bool is_trivially_copyable_v
is_trivially_copyable的便捷变量模板
constexpr bool is_move_assignable_v
is_move_assignable的便捷变量模板
constexpr bool is_copy_assignable_v
is_copy_assignable的便捷变量模板
integral_constant< uint64_t, Value > uint64_constant
64位无符号整数常量包装器
constexpr bool negation_v
negation的便捷变量模板
constexpr bool conjunction_v
conjunction的便捷变量模板
typename conditional< Test, T1, T2 >::type conditional_t
conditional的便捷别名
constexpr bool is_any_of_v
is_any_of的便捷变量模板
integral_constant< uint32_t, Value > uint32_constant
32位无符号整数常量包装器
bool_constant< true > true_type
表示true的类型
constexpr bool is_same_v
is_same的便捷变量模板
void void_t
将任意类型映射为void
constexpr bool disjunction_v
disjunction的便捷变量模板
typename type_identity< T >::type type_identity_t
type_identity的便捷别名
bool_constant< false > false_type
表示false的类型
integral_constant< bool, Value > bool_constant
布尔常量包装器
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
自身类型
constexpr value_type operator()() const noexcept
判断类型是否支持通过ADL查找的swap
判断类型是否为抽象类型
判断类型是否为聚合类型
判断类型是否可以进行内存分配
判断类型是否为分配器
判断类型是否在类型集合中
判断类型是否为算术类型
判断类型是否为数组类型
判断类型是否可以使用指定类型的值进行赋值
判断Base是否是Derived的基类
判断类型是否为布尔类型
判断类型是否为有界数组
判断类型是否为字符类型
判断类型是否为类类型
判断类型是否为复合类型
判断类型是否被const限定
判断类型是否可以使用指定参数构造
判断类型From是否可以隐式转换为类型To
判断类型是否可复制赋值
判断类型是否可复制构造
判断类型是否为C风格字符串类型
判断类型是否可以递减
判断类型是否可默认构造
判断类型是否可析构
判断类型是否为空类型
判断类型是否为枚举类型
判断类型是否被final限定
判断类型是否为浮点数类型
判断类型是否为函数类型
判断类型是否为基本类型
判断类型是否可隐式默认构造
判断类型是否可以递增
判断类型是否为类整数类型
判断类型是否为整数类型
判断类型是否可迭代
判断两个类型是否布局兼容
判断类型是否是位置不变的
判断类型是否为左值引用
判断类型是否类似映射
判断类型是否为成员函数指针
判断类型是否为成员对象指针
判断类型是否为成员指针
判断类型是否可移动赋值
判断类型是否可移动构造
判断迭代器的箭头运算符是否不会抛出异常
判断类型是否可以使用指定类型的值进行无异常赋值
判断类型是否可以使用指定参数无异常构造
判断类型From是否可以无异常地转换为类型To
判断类型是否可无异常复制赋值
判断类型是否可无异常复制构造
判断类型是否可无异常默认构造
判断类型是否可无异常析构
判断类型是否可无异常移动赋值
判断类型是否可无异常移动构造
判断是否可以无异常地从T1交换到T2
判断两个类型是否可以无异常地互相交换
判断类型是否可以与自身无异常交换
判断类型是否为nullptr_t
判断类型是否为对象类型
判断类型是否被包装
判断类型是否为POD类型
判断Base是否是Derived的指针可互转换基类
判断类型是否为指针类型
判断类型是否为多态类型
判断类型是否为引用类型
判断类型是否为右值引用
判断两个类型是否相同
判断类型是否为标量类型
判断类型是否为有符号类型
判断类型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限定符
替换模板的第一个类型参数
类型标识包装器
获取枚举类型的底层整数类型
类型解包器模板
基本类型别名