29 #ifndef _GLIBCXX_TYPE_TRAITS
30 #define _GLIBCXX_TYPE_TRAITS 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
40 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
44 template<
typename _Tp>
45 class reference_wrapper;
61 template<
typename _Tp, _Tp __v>
64 static constexpr _Tp value = __v;
65 typedef _Tp value_type;
67 constexpr
operator value_type()
const noexcept {
return value; }
68 #if __cplusplus > 201103L
70 #define __cpp_lib_integral_constant_callable 201304L
72 constexpr value_type operator()()
const noexcept {
return value; }
76 #if ! __cpp_inline_variables
77 template<
typename _Tp, _Tp __v>
93 #if __cplusplus >= 201703L
94 # define __cpp_lib_bool_constant 201505L
106 template<
typename _Tp,
typename>
111 struct __conditional<false>
113 template<
typename,
typename _Up>
118 template<
bool _Cond,
typename _If,
typename _Else>
119 using __conditional_t
120 =
typename __conditional<_Cond>::template type<_If, _Else>;
123 template <
typename _Type>
124 struct __type_identity
125 {
using type = _Type; };
127 template<
typename _Tp>
128 using __type_identity_t =
typename __type_identity<_Tp>::type;
130 template<
typename...>
138 template<
typename _B1>
143 template<
typename _B1,
typename _B2>
144 struct __or_<_B1, _B2>
145 :
public __conditional_t<_B1::value, _B1, _B2>
148 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
149 struct __or_<_B1, _B2, _B3, _Bn...>
150 :
public __conditional_t<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>
153 template<
typename...>
161 template<
typename _B1>
166 template<
typename _B1,
typename _B2>
167 struct __and_<_B1, _B2>
168 :
public __conditional_t<_B1::value, _B2, _B1>
171 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
172 struct __and_<_B1, _B2, _B3, _Bn...>
173 :
public __conditional_t<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>
176 template<
typename _Pp>
178 :
public __bool_constant<!bool(_Pp::value)>
182 #if __cplusplus >= 201703L
185 template<
typename... _Bn>
186 inline constexpr
bool __or_v = __or_<_Bn...>::value;
187 template<
typename... _Bn>
188 inline constexpr
bool __and_v = __and_<_Bn...>::value;
191 #define __cpp_lib_logical_traits 201510L
193 template<
typename... _Bn>
198 template<
typename... _Bn>
203 template<
typename _Pp>
211 template<
typename... _Bn>
212 inline constexpr
bool conjunction_v = conjunction<_Bn...>::value;
214 template<
typename... _Bn>
215 inline constexpr
bool disjunction_v = disjunction<_Bn...>::value;
217 template<
typename _Pp>
218 inline constexpr
bool negation_v = negation<_Pp>::value;
237 struct __is_array_unknown_bounds;
242 template <
typename _Tp,
size_t = sizeof(_Tp)>
243 constexpr
true_type __is_complete_or_unbounded(__type_identity<_Tp>)
246 template <
typename _TypeIdentity,
247 typename _NestedType =
typename _TypeIdentity::type>
248 constexpr
typename __or_<
249 is_reference<_NestedType>,
250 is_function<_NestedType>,
251 is_void<_NestedType>,
252 __is_array_unknown_bounds<_NestedType>
253 >::type __is_complete_or_unbounded(_TypeIdentity)
261 template<
typename _Tp>
262 struct __success_type
263 {
typedef _Tp type; };
265 struct __failure_type
269 template<
typename _Tp>
270 using __remove_cv_t =
typename remove_cv<_Tp>::type;
275 struct __is_void_helper
279 struct __is_void_helper<void>
284 template<
typename _Tp>
286 :
public __is_void_helper<__remove_cv_t<_Tp>>::type
291 struct __is_integral_helper
295 struct __is_integral_helper<bool>
299 struct __is_integral_helper<char>
303 struct __is_integral_helper<signed char>
307 struct __is_integral_helper<unsigned char>
314 struct __is_integral_helper<wchar_t>
317 #ifdef _GLIBCXX_USE_CHAR8_T
319 struct __is_integral_helper<char8_t>
324 struct __is_integral_helper<char16_t>
328 struct __is_integral_helper<char32_t>
332 struct __is_integral_helper<short>
336 struct __is_integral_helper<unsigned short>
340 struct __is_integral_helper<int>
344 struct __is_integral_helper<unsigned int>
348 struct __is_integral_helper<long>
352 struct __is_integral_helper<unsigned long>
356 struct __is_integral_helper<long long>
360 struct __is_integral_helper<unsigned long long>
365 #if defined(__GLIBCXX_TYPE_INT_N_0)
368 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
373 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
376 #if defined(__GLIBCXX_TYPE_INT_N_1)
379 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
384 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
387 #if defined(__GLIBCXX_TYPE_INT_N_2)
390 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
395 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
398 #if defined(__GLIBCXX_TYPE_INT_N_3)
401 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
406 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
412 template<
typename _Tp>
414 :
public __is_integral_helper<__remove_cv_t<_Tp>>::type
419 struct __is_floating_point_helper
423 struct __is_floating_point_helper<float>
427 struct __is_floating_point_helper<double>
431 struct __is_floating_point_helper<long double>
434 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) && !defined(__CUDACC__)
436 struct __is_floating_point_helper<__float128>
442 template<
typename _Tp>
444 :
public __is_floating_point_helper<__remove_cv_t<_Tp>>::type
452 template<
typename _Tp, std::
size_t _Size>
456 template<
typename _Tp>
457 struct is_array<_Tp[]>
461 struct __is_pointer_helper
464 template<
typename _Tp>
465 struct __is_pointer_helper<_Tp*>
469 template<
typename _Tp>
471 :
public __is_pointer_helper<__remove_cv_t<_Tp>>
::type
479 template<
typename _Tp>
488 template<
typename _Tp>
493 struct __is_member_object_pointer_helper
496 template<
typename _Tp,
typename _Cp>
497 struct __is_member_object_pointer_helper<_Tp _Cp::*>
498 :
public __not_<is_function<_Tp>>::type { };
501 template<
typename _Tp>
503 :
public __is_member_object_pointer_helper<__remove_cv_t<_Tp>>
::type
507 struct __is_member_function_pointer_helper
510 template<
typename _Tp,
typename _Cp>
511 struct __is_member_function_pointer_helper<_Tp _Cp::*>
512 :
public is_function<_Tp>::type { };
515 template<
typename _Tp>
517 :
public __is_member_function_pointer_helper<__remove_cv_t<_Tp>>
::type
521 template<
typename _Tp>
527 template<
typename _Tp>
533 template<
typename _Tp>
539 template<
typename _Tp>
541 :
public __bool_constant<!is_const<const _Tp>::value> { };
543 template<
typename _Tp>
547 template<
typename _Tp>
548 struct is_function<_Tp&&>
551 #define __cpp_lib_is_null_pointer 201309L
554 struct __is_null_pointer_helper
558 struct __is_null_pointer_helper<
std::nullptr_t>
562 template<
typename _Tp>
564 :
public __is_null_pointer_helper<__remove_cv_t<_Tp>>
::type
569 template<
typename _Tp>
572 { } _GLIBCXX_DEPRECATED_SUGGEST(
"std::is_null_pointer");
577 template<
typename _Tp>
579 :
public __or_<is_lvalue_reference<_Tp>,
580 is_rvalue_reference<_Tp>>::type
584 template<
typename _Tp>
586 :
public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
590 template<
typename _Tp>
592 :
public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
593 is_null_pointer<_Tp>>::type
597 template<
typename _Tp>
599 :
public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
607 template<
typename _Tp>
609 :
public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
610 is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
614 template<
typename _Tp>
616 :
public __not_<is_fundamental<_Tp>>::type { };
619 template<
typename _Tp>
620 struct __is_member_pointer_helper
623 template<
typename _Tp,
typename _Cp>
624 struct __is_member_pointer_helper<_Tp _Cp::*>
629 template<
typename _Tp>
631 :
public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type
634 template<
typename,
typename>
638 template<
typename _Tp,
typename... _Types>
639 using __is_one_of = __or_<is_same<_Tp, _Types>...>;
643 template<
typename _Tp>
644 using __is_signed_integer = __is_one_of<__remove_cv_t<_Tp>,
645 signed char,
signed short,
signed int,
signed long,
647 #if defined(__GLIBCXX_TYPE_INT_N_0)
648 ,
signed __GLIBCXX_TYPE_INT_N_0
650 #if defined(__GLIBCXX_TYPE_INT_N_1)
651 ,
signed __GLIBCXX_TYPE_INT_N_1
653 #if defined(__GLIBCXX_TYPE_INT_N_2)
654 ,
signed __GLIBCXX_TYPE_INT_N_2
656 #if defined(__GLIBCXX_TYPE_INT_N_3)
657 ,
signed __GLIBCXX_TYPE_INT_N_3
663 template<
typename _Tp>
664 using __is_unsigned_integer = __is_one_of<__remove_cv_t<_Tp>,
665 unsigned char,
unsigned short,
unsigned int,
unsigned long,
667 #if defined(__GLIBCXX_TYPE_INT_N_0)
668 ,
unsigned __GLIBCXX_TYPE_INT_N_0
670 #if defined(__GLIBCXX_TYPE_INT_N_1)
671 ,
unsigned __GLIBCXX_TYPE_INT_N_1
673 #if defined(__GLIBCXX_TYPE_INT_N_2)
674 ,
unsigned __GLIBCXX_TYPE_INT_N_2
676 #if defined(__GLIBCXX_TYPE_INT_N_3)
677 ,
unsigned __GLIBCXX_TYPE_INT_N_3
682 template<
typename _Tp>
683 using __is_standard_integer
684 = __or_<__is_signed_integer<_Tp>, __is_unsigned_integer<_Tp>>;
687 template<
typename...>
using __void_t = void;
691 template<
typename _Tp,
typename =
void>
692 struct __is_referenceable
696 template<
typename _Tp>
697 struct __is_referenceable<_Tp, __void_t<_Tp&>>
709 template<
typename _Tp>
718 template<
typename _Tp>
723 template<
typename _Tp>
727 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
728 "template argument must be a complete class or an unbounded array");
732 template<
typename _Tp>
736 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
737 "template argument must be a complete class or an unbounded array");
741 template<
typename _Tp>
745 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
746 "template argument must be a complete class or an unbounded array");
754 template<
typename _Tp>
756 _GLIBCXX20_DEPRECATED(
"use is_standard_layout && is_trivial instead")
760 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
761 "template argument must be a complete class or an unbounded array");
768 template<
typename _Tp>
770 _GLIBCXX17_DEPRECATED
774 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
775 "template argument must be a complete class or an unbounded array");
779 template<
typename _Tp>
785 template<
typename _Tp>
790 #if __cplusplus >= 201402L
791 #define __cpp_lib_is_final 201402L
794 template<
typename _Tp>
801 template<
typename _Tp>
807 template<
typename _Tp,
809 struct __is_signed_helper
812 template<
typename _Tp>
813 struct __is_signed_helper<_Tp, true>
814 :
public integral_constant<bool, _Tp(-1) < _Tp(0)>
819 template<typename _Tp>
821 : public __is_signed_helper<_Tp>::type
825 template<typename _Tp>
827 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>
831 template<typename _Tp, typename _Up = _Tp&&>
835 template<typename _Tp>
840 template<typename _Tp>
841 auto declval() noexcept -> decltype(__declval<_Tp>(0));
843 template<typename, unsigned = 0>
850 template<typename _Tp>
851 struct __is_array_known_bounds
855 template<
typename _Tp>
856 struct __is_array_unknown_bounds
857 :
public __and_<is_array<_Tp>, __not_<extent<_Tp>>>
867 struct __do_is_destructible_impl
869 template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
876 template<
typename _Tp>
877 struct __is_destructible_impl
878 :
public __do_is_destructible_impl
880 typedef decltype(__test<_Tp>(0)) type;
883 template<typename _Tp,
884 bool = __or_<is_void<_Tp>,
885 __is_array_unknown_bounds<_Tp>,
886 is_function<_Tp>>::value,
887 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
888 struct __is_destructible_safe;
890 template<typename _Tp>
891 struct __is_destructible_safe<_Tp, false, false>
892 : public __is_destructible_impl<typename
893 remove_all_extents<_Tp>::type>::type
896 template<
typename _Tp>
897 struct __is_destructible_safe<_Tp, true, false>
900 template<
typename _Tp>
901 struct __is_destructible_safe<_Tp, false, true>
906 template<
typename _Tp>
908 :
public __is_destructible_safe<_Tp>::type
910 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
911 "template argument must be a complete class or an unbounded array");
920 struct __do_is_nt_destructible_impl
922 template<
typename _Tp>
923 static __bool_constant<noexcept(declval<_Tp&>().~_Tp())>
930 template<
typename _Tp>
931 struct __is_nt_destructible_impl
932 :
public __do_is_nt_destructible_impl
934 typedef decltype(__test<_Tp>(0)) type;
937 template<typename _Tp,
938 bool = __or_<is_void<_Tp>,
939 __is_array_unknown_bounds<_Tp>,
940 is_function<_Tp>>::value,
941 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
942 struct __is_nt_destructible_safe;
944 template<typename _Tp>
945 struct __is_nt_destructible_safe<_Tp, false, false>
946 : public __is_nt_destructible_impl<typename
947 remove_all_extents<_Tp>::type>::type
950 template<
typename _Tp>
951 struct __is_nt_destructible_safe<_Tp, true, false>
954 template<
typename _Tp>
955 struct __is_nt_destructible_safe<_Tp, false, true>
960 template<
typename _Tp>
962 :
public __is_nt_destructible_safe<_Tp>::type
964 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
965 "template argument must be a complete class or an unbounded array");
969 template<
typename _Tp,
typename... _Args>
970 struct __is_constructible_impl
971 :
public __bool_constant<__is_constructible(_Tp, _Args...)>
976 template<
typename _Tp,
typename... _Args>
978 :
public __is_constructible_impl<_Tp, _Args...>
980 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
981 "template argument must be a complete class or an unbounded array");
985 template<
typename _Tp>
987 :
public __is_constructible_impl<_Tp>::type
989 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
990 "template argument must be a complete class or an unbounded array");
994 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
995 struct __is_copy_constructible_impl;
997 template<
typename _Tp>
998 struct __is_copy_constructible_impl<_Tp, false>
1001 template<
typename _Tp>
1002 struct __is_copy_constructible_impl<_Tp, true>
1003 :
public __is_constructible_impl<_Tp, const _Tp&>
1008 template<
typename _Tp>
1010 :
public __is_copy_constructible_impl<_Tp>
1012 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1013 "template argument must be a complete class or an unbounded array");
1017 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1018 struct __is_move_constructible_impl;
1020 template<
typename _Tp>
1021 struct __is_move_constructible_impl<_Tp, false>
1024 template<
typename _Tp>
1025 struct __is_move_constructible_impl<_Tp, true>
1026 :
public __is_constructible_impl<_Tp, _Tp&&>
1031 template<
typename _Tp>
1033 :
public __is_move_constructible_impl<_Tp>
1035 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1036 "template argument must be a complete class or an unbounded array");
1040 template<
typename _Tp,
typename... _Args>
1041 using __is_nothrow_constructible_impl
1042 = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;
1046 template<
typename _Tp,
typename... _Args>
1048 :
public __is_nothrow_constructible_impl<_Tp, _Args...>::type
1050 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1051 "template argument must be a complete class or an unbounded array");
1055 template<
typename _Tp>
1057 :
public __bool_constant<__is_nothrow_constructible(_Tp)>
1059 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1060 "template argument must be a complete class or an unbounded array");
1064 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1065 struct __is_nothrow_copy_constructible_impl;
1067 template<
typename _Tp>
1068 struct __is_nothrow_copy_constructible_impl<_Tp, false>
1071 template<
typename _Tp>
1072 struct __is_nothrow_copy_constructible_impl<_Tp, true>
1073 :
public __is_nothrow_constructible_impl<_Tp, const _Tp&>
1078 template<
typename _Tp>
1080 :
public __is_nothrow_copy_constructible_impl<_Tp>::type
1082 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1083 "template argument must be a complete class or an unbounded array");
1087 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1088 struct __is_nothrow_move_constructible_impl;
1090 template<
typename _Tp>
1091 struct __is_nothrow_move_constructible_impl<_Tp, false>
1094 template<
typename _Tp>
1095 struct __is_nothrow_move_constructible_impl<_Tp, true>
1096 :
public __is_nothrow_constructible_impl<_Tp, _Tp&&>
1101 template<
typename _Tp>
1103 :
public __is_nothrow_move_constructible_impl<_Tp>::type
1105 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1106 "template argument must be a complete class or an unbounded array");
1110 template<
typename _Tp,
typename _Up>
1112 :
public __bool_constant<__is_assignable(_Tp, _Up)>
1114 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1115 "template argument must be a complete class or an unbounded array");
1118 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1119 struct __is_copy_assignable_impl;
1121 template<
typename _Tp>
1122 struct __is_copy_assignable_impl<_Tp, false>
1125 template<
typename _Tp>
1126 struct __is_copy_assignable_impl<_Tp, true>
1127 :
public __bool_constant<__is_assignable(_Tp&, const _Tp&)>
1131 template<
typename _Tp>
1133 :
public __is_copy_assignable_impl<_Tp>::type
1135 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1136 "template argument must be a complete class or an unbounded array");
1139 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1140 struct __is_move_assignable_impl;
1142 template<
typename _Tp>
1143 struct __is_move_assignable_impl<_Tp, false>
1146 template<
typename _Tp>
1147 struct __is_move_assignable_impl<_Tp, true>
1148 :
public __bool_constant<__is_assignable(_Tp&, _Tp&&)>
1152 template<
typename _Tp>
1154 :
public __is_move_assignable_impl<_Tp>::type
1156 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1157 "template argument must be a complete class or an unbounded array");
1160 template<
typename _Tp,
typename _Up>
1161 using __is_nothrow_assignable_impl
1162 = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>;
1165 template<
typename _Tp,
typename _Up>
1167 :
public __is_nothrow_assignable_impl<_Tp, _Up>
1169 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1170 "template argument must be a complete class or an unbounded array");
1173 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1174 struct __is_nt_copy_assignable_impl;
1176 template<
typename _Tp>
1177 struct __is_nt_copy_assignable_impl<_Tp, false>
1180 template<
typename _Tp>
1181 struct __is_nt_copy_assignable_impl<_Tp, true>
1182 :
public __is_nothrow_assignable_impl<_Tp&, const _Tp&>
1186 template<
typename _Tp>
1188 :
public __is_nt_copy_assignable_impl<_Tp>
1190 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1191 "template argument must be a complete class or an unbounded array");
1194 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1195 struct __is_nt_move_assignable_impl;
1197 template<
typename _Tp>
1198 struct __is_nt_move_assignable_impl<_Tp, false>
1201 template<
typename _Tp>
1202 struct __is_nt_move_assignable_impl<_Tp, true>
1203 :
public __is_nothrow_assignable_impl<_Tp&, _Tp&&>
1207 template<
typename _Tp>
1209 :
public __is_nt_move_assignable_impl<_Tp>
1211 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1212 "template argument must be a complete class or an unbounded array");
1216 template<
typename _Tp,
typename... _Args>
1218 :
public __bool_constant<__is_trivially_constructible(_Tp, _Args...)>
1220 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1221 "template argument must be a complete class or an unbounded array");
1225 template<
typename _Tp>
1227 :
public __bool_constant<__is_trivially_constructible(_Tp)>
1229 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1230 "template argument must be a complete class or an unbounded array");
1233 struct __do_is_implicitly_default_constructible_impl
1235 template <
typename _Tp>
1236 static void __helper(
const _Tp&);
1238 template <
typename _Tp>
1240 decltype(__helper<const _Tp&>({}))* = 0);
1245 template<
typename _Tp>
1246 struct __is_implicitly_default_constructible_impl
1247 :
public __do_is_implicitly_default_constructible_impl
1249 typedef decltype(__test(declval<_Tp>())) type;
1252 template<typename _Tp>
1253 struct __is_implicitly_default_constructible_safe
1254 : public __is_implicitly_default_constructible_impl<_Tp>::type
1257 template <
typename _Tp>
1258 struct __is_implicitly_default_constructible
1259 :
public __and_<__is_constructible_impl<_Tp>,
1260 __is_implicitly_default_constructible_safe<_Tp>>
1263 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1264 struct __is_trivially_copy_constructible_impl;
1266 template<
typename _Tp>
1267 struct __is_trivially_copy_constructible_impl<_Tp, false>
1270 template<
typename _Tp>
1271 struct __is_trivially_copy_constructible_impl<_Tp, true>
1272 :
public __and_<__is_copy_constructible_impl<_Tp>,
1273 integral_constant<bool,
1274 __is_trivially_constructible(_Tp, const _Tp&)>>
1278 template<
typename _Tp>
1280 :
public __is_trivially_copy_constructible_impl<_Tp>
1282 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1283 "template argument must be a complete class or an unbounded array");
1286 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1287 struct __is_trivially_move_constructible_impl;
1289 template<
typename _Tp>
1290 struct __is_trivially_move_constructible_impl<_Tp, false>
1293 template<
typename _Tp>
1294 struct __is_trivially_move_constructible_impl<_Tp, true>
1295 :
public __and_<__is_move_constructible_impl<_Tp>,
1296 integral_constant<bool,
1297 __is_trivially_constructible(_Tp, _Tp&&)>>
1301 template<
typename _Tp>
1303 :
public __is_trivially_move_constructible_impl<_Tp>
1305 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1306 "template argument must be a complete class or an unbounded array");
1310 template<
typename _Tp,
typename _Up>
1312 :
public __bool_constant<__is_trivially_assignable(_Tp, _Up)>
1314 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1315 "template argument must be a complete class or an unbounded array");
1318 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1319 struct __is_trivially_copy_assignable_impl;
1321 template<
typename _Tp>
1322 struct __is_trivially_copy_assignable_impl<_Tp, false>
1325 template<
typename _Tp>
1326 struct __is_trivially_copy_assignable_impl<_Tp, true>
1327 :
public __bool_constant<__is_trivially_assignable(_Tp&, const _Tp&)>
1331 template<
typename _Tp>
1333 :
public __is_trivially_copy_assignable_impl<_Tp>
1335 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1336 "template argument must be a complete class or an unbounded array");
1339 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1340 struct __is_trivially_move_assignable_impl;
1342 template<
typename _Tp>
1343 struct __is_trivially_move_assignable_impl<_Tp, false>
1346 template<
typename _Tp>
1347 struct __is_trivially_move_assignable_impl<_Tp, true>
1348 :
public __bool_constant<__is_trivially_assignable(_Tp&, _Tp&&)>
1352 template<
typename _Tp>
1354 :
public __is_trivially_move_assignable_impl<_Tp>
1356 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1357 "template argument must be a complete class or an unbounded array");
1361 template<
typename _Tp>
1363 :
public __and_<__is_destructible_safe<_Tp>,
1364 __bool_constant<__has_trivial_destructor(_Tp)>>
1366 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1367 "template argument must be a complete class or an unbounded array");
1372 template<
typename _Tp>
1376 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1377 "template argument must be a complete class or an unbounded array");
1384 template<
typename _Tp>
1388 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1389 "template argument must be a complete class or an unbounded array");
1397 template<
typename _Tp, std::
size_t _Size>
1398 struct rank<_Tp[_Size]>
1401 template<
typename _Tp>
1403 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1406 template<
typename,
unsigned _U
int>
1410 template<
typename _Tp,
unsigned _U
int, std::
size_t _Size>
1411 struct extent<_Tp[_Size], _Uint>
1413 _Uint == 0 ? _Size : extent<_Tp,
1417 template<
typename _Tp,
unsigned _U
int>
1418 struct extent<_Tp[], _Uint>
1419 :
public integral_constant<std::size_t,
1420 _Uint == 0 ? 0 : extent<_Tp,
1428 template<
typename _Tp,
typename _Up>
1430 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME
1437 #ifndef _GLIBCXX_HAVE_BUILTIN_IS_SAME
1438 template<
typename _Tp>
1445 template<
typename _Base,
typename _Derived>
1450 template<
typename _From,
typename _To,
1453 struct __is_convertible_helper
1458 #pragma GCC diagnostic push
1459 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1460 template<
typename _From,
typename _To>
1461 class __is_convertible_helper<_From, _To, false>
1463 template<
typename _To1>
1464 static void __test_aux(_To1) noexcept;
1466 template<
typename _From1,
typename _To1,
1467 typename = decltype(__test_aux<_To1>(std::declval<_From1>()))>
1471 template<
typename,
typename>
1476 typedef decltype(__test<_From, _To>(0)) type;
1478 #pragma GCC diagnostic pop
1481 template<
typename _From,
typename _To>
1483 :
public __is_convertible_helper<_From, _To>::type
1487 template<
typename _ToElementType,
typename _FromElementType>
1491 template<
typename _From,
typename _To,
1494 struct __is_nt_convertible_helper
1498 #pragma GCC diagnostic push
1499 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1500 template<
typename _From,
typename _To>
1501 class __is_nt_convertible_helper<_From, _To, false>
1503 template<
typename _To1>
1504 static void __test_aux(_To1) noexcept;
1506 template<
typename _From1,
typename _To1>
1508 __bool_constant<noexcept(__test_aux<_To1>(std::declval<_From1>()))>
1511 template<
typename,
typename>
1516 using type = decltype(__test<_From, _To>(0));
1518 #pragma GCC diagnostic pop
1520 #if __cplusplus > 201703L
1521 #define __cpp_lib_is_nothrow_convertible 201806L
1523 template<
typename _From,
typename _To>
1525 :
public __is_nt_convertible_helper<_From, _To>::type
1529 template<
typename _From,
typename _To>
1537 template<
typename _Tp>
1539 {
typedef _Tp type; };
1541 template<
typename _Tp>
1543 {
typedef _Tp type; };
1546 template<
typename _Tp>
1548 {
typedef _Tp type; };
1550 template<
typename _Tp>
1552 {
typedef _Tp type; };
1555 template<
typename _Tp>
1557 {
using type = _Tp; };
1559 template<
typename _Tp>
1561 {
using type = _Tp; };
1563 template<
typename _Tp>
1564 struct remove_cv<volatile _Tp>
1565 {
using type = _Tp; };
1567 template<
typename _Tp>
1568 struct remove_cv<const volatile _Tp>
1569 {
using type = _Tp; };
1572 template<
typename _Tp>
1574 {
typedef _Tp
const type; };
1577 template<
typename _Tp>
1579 {
typedef _Tp
volatile type; };
1582 template<
typename _Tp>
1589 #if __cplusplus > 201103L
1591 #define __cpp_lib_transformation_trait_aliases 201304L
1594 template<
typename _Tp>
1598 template<
typename _Tp>
1602 template<
typename _Tp>
1606 template<
typename _Tp>
1610 template<
typename _Tp>
1614 template<
typename _Tp>
1621 template<
typename _Tp>
1623 {
typedef _Tp type; };
1625 template<
typename _Tp>
1627 {
typedef _Tp type; };
1629 template<
typename _Tp>
1630 struct remove_reference<_Tp&&>
1631 {
typedef _Tp type; };
1633 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1634 struct __add_lvalue_reference_helper
1635 {
typedef _Tp type; };
1637 template<
typename _Tp>
1638 struct __add_lvalue_reference_helper<_Tp, true>
1639 {
typedef _Tp& type; };
1642 template<
typename _Tp>
1644 :
public __add_lvalue_reference_helper<_Tp>
1647 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1648 struct __add_rvalue_reference_helper
1649 {
typedef _Tp type; };
1651 template<
typename _Tp>
1652 struct __add_rvalue_reference_helper<_Tp, true>
1653 {
typedef _Tp&& type; };
1656 template<
typename _Tp>
1658 :
public __add_rvalue_reference_helper<_Tp>
1661 #if __cplusplus > 201103L
1663 template<
typename _Tp>
1667 template<
typename _Tp>
1671 template<
typename _Tp>
1680 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1681 struct __cv_selector;
1683 template<
typename _Unqualified>
1684 struct __cv_selector<_Unqualified, false, false>
1685 {
typedef _Unqualified __type; };
1687 template<
typename _Unqualified>
1688 struct __cv_selector<_Unqualified, false, true>
1689 {
typedef volatile _Unqualified __type; };
1691 template<
typename _Unqualified>
1692 struct __cv_selector<_Unqualified, true, false>
1693 {
typedef const _Unqualified __type; };
1695 template<
typename _Unqualified>
1696 struct __cv_selector<_Unqualified, true, true>
1697 {
typedef const volatile _Unqualified __type; };
1699 template<
typename _Qualified,
typename _Unqualified,
1700 bool _IsConst = is_const<_Qualified>::value,
1701 bool _IsVol = is_volatile<_Qualified>::value>
1702 class __match_cv_qualifiers
1704 typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
1707 typedef typename __match::__type __type;
1711 template<
typename _Tp>
1712 struct __make_unsigned
1713 {
typedef _Tp __type; };
1716 struct __make_unsigned<char>
1717 {
typedef unsigned char __type; };
1720 struct __make_unsigned<signed char>
1721 {
typedef unsigned char __type; };
1724 struct __make_unsigned<short>
1725 {
typedef unsigned short __type; };
1728 struct __make_unsigned<int>
1729 {
typedef unsigned int __type; };
1732 struct __make_unsigned<long>
1733 {
typedef unsigned long __type; };
1736 struct __make_unsigned<long long>
1737 {
typedef unsigned long long __type; };
1739 #if defined(__GLIBCXX_TYPE_INT_N_0)
1742 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1743 {
typedef unsigned __GLIBCXX_TYPE_INT_N_0 __type; };
1745 #if defined(__GLIBCXX_TYPE_INT_N_1)
1748 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
1749 {
typedef unsigned __GLIBCXX_TYPE_INT_N_1 __type; };
1751 #if defined(__GLIBCXX_TYPE_INT_N_2)
1754 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
1755 {
typedef unsigned __GLIBCXX_TYPE_INT_N_2 __type; };
1757 #if defined(__GLIBCXX_TYPE_INT_N_3)
1760 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
1761 {
typedef unsigned __GLIBCXX_TYPE_INT_N_3 __type; };
1765 template<
typename _Tp,
1766 bool _IsInt = is_integral<_Tp>::value,
1767 bool _IsEnum = is_enum<_Tp>::value>
1768 class __make_unsigned_selector;
1770 template<
typename _Tp>
1771 class __make_unsigned_selector<_Tp, true, false>
1773 using __unsigned_type
1774 =
typename __make_unsigned<__remove_cv_t<_Tp>>::__type;
1778 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1781 class __make_unsigned_selector_base
1784 template<
typename...>
struct _List { };
1786 template<
typename _Tp,
typename... _Up>
1787 struct _List<_Tp, _Up...> : _List<_Up...>
1788 {
static constexpr
size_t __size =
sizeof(_Tp); };
1790 template<
size_t _Sz,
typename _Tp,
bool = (_Sz <= _Tp::__size)>
1793 template<
size_t _Sz,
typename _U
int,
typename... _UInts>
1794 struct __select<_Sz, _List<_Uint, _UInts...>,
true>
1795 {
using __type = _Uint; };
1797 template<
size_t _Sz,
typename _Uint,
typename... _UInts>
1798 struct __select<_Sz, _List<_Uint, _UInts...>, false>
1799 : __select<_Sz, _List<_UInts...>>
1804 template<
typename _Tp>
1805 class __make_unsigned_selector<_Tp, false, true>
1806 : __make_unsigned_selector_base
1809 using _UInts = _List<
unsigned char,
unsigned short,
unsigned int,
1810 unsigned long,
unsigned long long>;
1812 using __unsigned_type =
typename __select<
sizeof(_Tp), _UInts>::__type;
1816 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1824 struct __make_unsigned<wchar_t>
1827 =
typename __make_unsigned_selector<wchar_t, false, true>::__type;
1830 #ifdef _GLIBCXX_USE_CHAR8_T
1832 struct __make_unsigned<char8_t>
1835 =
typename __make_unsigned_selector<char8_t, false, true>::__type;
1840 struct __make_unsigned<char16_t>
1843 =
typename __make_unsigned_selector<char16_t, false, true>::__type;
1847 struct __make_unsigned<char32_t>
1850 =
typename __make_unsigned_selector<char32_t, false, true>::__type;
1858 template<
typename _Tp>
1860 {
typedef typename __make_unsigned_selector<_Tp>::__type type; };
1869 template<
typename _Tp>
1870 struct __make_signed
1871 {
typedef _Tp __type; };
1874 struct __make_signed<char>
1875 {
typedef signed char __type; };
1878 struct __make_signed<unsigned char>
1879 {
typedef signed char __type; };
1882 struct __make_signed<unsigned short>
1883 {
typedef signed short __type; };
1886 struct __make_signed<unsigned int>
1887 {
typedef signed int __type; };
1890 struct __make_signed<unsigned long>
1891 {
typedef signed long __type; };
1894 struct __make_signed<unsigned long long>
1895 {
typedef signed long long __type; };
1897 #if defined(__GLIBCXX_TYPE_INT_N_0)
1900 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
1901 {
typedef __GLIBCXX_TYPE_INT_N_0 __type; };
1903 #if defined(__GLIBCXX_TYPE_INT_N_1)
1906 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
1907 {
typedef __GLIBCXX_TYPE_INT_N_1 __type; };
1909 #if defined(__GLIBCXX_TYPE_INT_N_2)
1912 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
1913 {
typedef __GLIBCXX_TYPE_INT_N_2 __type; };
1915 #if defined(__GLIBCXX_TYPE_INT_N_3)
1918 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
1919 {
typedef __GLIBCXX_TYPE_INT_N_3 __type; };
1923 template<
typename _Tp,
1924 bool _IsInt = is_integral<_Tp>::value,
1925 bool _IsEnum = is_enum<_Tp>::value>
1926 class __make_signed_selector;
1928 template<
typename _Tp>
1929 class __make_signed_selector<_Tp, true, false>
1932 =
typename __make_signed<__remove_cv_t<_Tp>>::__type;
1936 =
typename __match_cv_qualifiers<_Tp, __signed_type>::__type;
1940 template<
typename _Tp>
1941 class __make_signed_selector<_Tp, false, true>
1943 typedef typename __make_unsigned_selector<_Tp>::__type __unsigned_type;
1946 typedef typename __make_signed_selector<__unsigned_type>::__type __type;
1954 struct __make_signed<wchar_t>
1957 =
typename __make_signed_selector<wchar_t, false, true>::__type;
1960 #if defined(_GLIBCXX_USE_CHAR8_T)
1962 struct __make_signed<char8_t>
1965 =
typename __make_signed_selector<char8_t, false, true>::__type;
1970 struct __make_signed<char16_t>
1973 =
typename __make_signed_selector<char16_t, false, true>::__type;
1977 struct __make_signed<char32_t>
1980 =
typename __make_signed_selector<char32_t, false, true>::__type;
1988 template<
typename _Tp>
1990 {
typedef typename __make_signed_selector<_Tp>::__type type; };
1996 #if __cplusplus > 201103L
1998 template<
typename _Tp>
2002 template<
typename _Tp>
2009 template<
typename _Tp>
2011 {
typedef _Tp type; };
2013 template<
typename _Tp, std::
size_t _Size>
2015 {
typedef _Tp type; };
2017 template<
typename _Tp>
2018 struct remove_extent<_Tp[]>
2019 {
typedef _Tp type; };
2022 template<
typename _Tp>
2024 {
typedef _Tp type; };
2026 template<
typename _Tp, std::
size_t _Size>
2028 {
typedef typename remove_all_extents<_Tp>::type type; };
2030 template<
typename _Tp>
2031 struct remove_all_extents<_Tp[]>
2032 {
typedef typename remove_all_extents<_Tp>::type type; };
2034 #if __cplusplus > 201103L
2036 template<
typename _Tp>
2040 template<
typename _Tp>
2046 template<
typename _Tp,
typename>
2047 struct __remove_pointer_helper
2048 {
typedef _Tp type; };
2050 template<
typename _Tp,
typename _Up>
2051 struct __remove_pointer_helper<_Tp, _Up*>
2052 {
typedef _Up type; };
2055 template<
typename _Tp>
2057 :
public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>>
2060 template<
typename _Tp,
bool = __or_<__is_referenceable<_Tp>,
2061 is_
void<_Tp>>::value>
2062 struct __add_pointer_helper
2063 {
typedef _Tp type; };
2065 template<
typename _Tp>
2066 struct __add_pointer_helper<_Tp, true>
2067 {
typedef typename remove_reference<_Tp>::type* type; };
2070 template<
typename _Tp>
2072 :
public __add_pointer_helper<_Tp>
2075 #if __cplusplus > 201103L
2077 template<
typename _Tp>
2081 template<
typename _Tp>
2085 template<std::
size_t _Len>
2086 struct __aligned_storage_msa
2090 unsigned char __data[_Len];
2091 struct __attribute__((__aligned__)) { } __align;
2105 template<std::size_t _Len, std::size_t _Align =
2106 __alignof__(
typename __aligned_storage_msa<_Len>::__type)>
2111 unsigned char __data[_Len];
2112 struct __attribute__((__aligned__((_Align)))) { } __align;
2116 template <
typename... _Types>
2117 struct __strictest_alignment
2119 static const size_t _S_alignment = 0;
2120 static const size_t _S_size = 0;
2123 template <
typename _Tp,
typename... _Types>
2124 struct __strictest_alignment<_Tp, _Types...>
2126 static const size_t _S_alignment =
2127 alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
2128 ?
alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
2129 static const size_t _S_size =
2130 sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
2131 ?
sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
2144 template <
size_t _Len,
typename... _Types>
2148 static_assert(
sizeof...(_Types) != 0,
"At least one type is required");
2150 using __strictest = __strictest_alignment<_Types...>;
2151 static const size_t _S_len = _Len > __strictest::_S_size
2152 ? _Len : __strictest::_S_size;
2155 static const size_t alignment_value = __strictest::_S_alignment;
2160 template <
size_t _Len,
typename... _Types>
2161 const size_t aligned_union<_Len, _Types...>::alignment_value;
2167 template<
typename _Up,
2170 struct __decay_selector;
2173 template<
typename _Up>
2174 struct __decay_selector<_Up, false, false>
2175 {
typedef __remove_cv_t<_Up> __type; };
2177 template<
typename _Up>
2178 struct __decay_selector<_Up, true, false>
2179 {
typedef typename remove_extent<_Up>::type* __type; };
2181 template<
typename _Up>
2182 struct __decay_selector<_Up, false, true>
2183 {
typedef typename add_pointer<_Up>::type __type; };
2187 template<
typename _Tp>
2190 typedef typename remove_reference<_Tp>::type __remove_type;
2193 typedef typename __decay_selector<__remove_type>::__type type;
2199 template<
typename _Tp>
2200 struct __strip_reference_wrapper
2205 template<
typename _Tp>
2206 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
2208 typedef _Tp& __type;
2212 template<
typename _Tp>
2213 using __decay_t =
typename decay<_Tp>::type;
2215 template<
typename _Tp>
2216 using __decay_and_strip = __strip_reference_wrapper<__decay_t<_Tp>>;
2221 template<
bool,
typename _Tp =
void>
2226 template<
typename _Tp>
2228 {
typedef _Tp type; };
2233 template<
bool _Cond,
typename _Tp =
void>
2234 using __enable_if_t =
typename enable_if<_Cond, _Tp>::type;
2237 template<
typename... _Cond>
2238 using _Require = __enable_if_t<__and_<_Cond...>::value>;
2241 template<
typename _Tp>
2242 using __remove_cvref_t
2243 =
typename remove_cv<typename remove_reference<_Tp>::type>::type;
2248 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2250 {
typedef _Iftrue type; };
2253 template<
typename _Iftrue,
typename _Iffalse>
2255 {
typedef _Iffalse type; };
2258 template<
typename... _Tp>
2264 struct __do_common_type_impl
2266 template<
typename _Tp,
typename _Up>
2268 = decltype(
true ? std::declval<_Tp>() : std::declval<_Up>());
2272 template<
typename _Tp,
typename _Up>
2273 static __success_type<__decay_t<__cond_t<_Tp, _Up>>>
2276 #if __cplusplus > 201703L
2279 template<
typename _Tp,
typename _Up>
2280 static __success_type<__remove_cvref_t<__cond_t<const _Tp&, const _Up&>>>
2284 template<
typename,
typename>
2285 static __failure_type
2288 template<
typename _Tp,
typename _Up>
2289 static decltype(_S_test_2<_Tp, _Up>(0))
2299 template<
typename _Tp0>
2305 template<
typename _Tp1,
typename _Tp2,
2306 typename _Dp1 = __decay_t<_Tp1>,
typename _Dp2 = __decay_t<_Tp2>>
2307 struct __common_type_impl
2311 using type = common_type<_Dp1, _Dp2>;
2314 template<
typename _Tp1,
typename _Tp2>
2315 struct __common_type_impl<_Tp1, _Tp2, _Tp1, _Tp2>
2316 :
private __do_common_type_impl
2320 using type = decltype(_S_test<_Tp1, _Tp2>(0));
2324 template<
typename _Tp1,
typename _Tp2>
2325 struct common_type<_Tp1, _Tp2>
2326 :
public __common_type_impl<_Tp1, _Tp2>::type
2329 template<
typename...>
2330 struct __common_type_pack
2333 template<
typename,
typename,
typename =
void>
2334 struct __common_type_fold;
2337 template<
typename _Tp1,
typename _Tp2,
typename... _Rp>
2338 struct common_type<_Tp1, _Tp2, _Rp...>
2339 :
public __common_type_fold<common_type<_Tp1, _Tp2>,
2340 __common_type_pack<_Rp...>>
2346 template<
typename _CTp,
typename... _Rp>
2347 struct __common_type_fold<_CTp, __common_type_pack<_Rp...>,
2348 __void_t<typename _CTp::type>>
2349 :
public common_type<typename _CTp::type, _Rp...>
2353 template<
typename _CTp,
typename _Rp>
2354 struct __common_type_fold<_CTp, _Rp, void>
2357 template<typename _Tp, bool = is_enum<_Tp>::value>
2358 struct __underlying_type_impl
2360 using type = __underlying_type(_Tp);
2363 template<
typename _Tp>
2364 struct __underlying_type_impl<_Tp, false>
2369 template<
typename _Tp>
2371 :
public __underlying_type_impl<_Tp>
2375 template<
typename _Tp>
2376 struct __declval_protector
2378 static const bool __stop =
false;
2386 template<
typename _Tp>
2387 auto declval() noexcept -> decltype(__declval<_Tp>(0))
2389 static_assert(__declval_protector<_Tp>::__stop,
2390 "declval() must not be used!");
2391 return __declval<_Tp>(0);
2395 template<
typename _Signature>
2400 #define __cpp_lib_result_of_sfinae 201210L
2403 struct __invoke_memfun_ref { };
2404 struct __invoke_memfun_deref { };
2405 struct __invoke_memobj_ref { };
2406 struct __invoke_memobj_deref { };
2407 struct __invoke_other { };
2410 template<
typename _Tp,
typename _Tag>
2411 struct __result_of_success : __success_type<_Tp>
2412 {
using __invoke_type = _Tag; };
2415 struct __result_of_memfun_ref_impl
2417 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2418 static __result_of_success<decltype(
2419 (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
2420 ), __invoke_memfun_ref> _S_test(
int);
2422 template<
typename...>
2423 static __failure_type _S_test(...);
2426 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2427 struct __result_of_memfun_ref
2428 :
private __result_of_memfun_ref_impl
2430 typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
2434 struct __result_of_memfun_deref_impl
2436 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2437 static __result_of_success<decltype(
2438 ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
2439 ), __invoke_memfun_deref> _S_test(
int);
2441 template<
typename...>
2442 static __failure_type _S_test(...);
2445 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2446 struct __result_of_memfun_deref
2447 :
private __result_of_memfun_deref_impl
2449 typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
2453 struct __result_of_memobj_ref_impl
2455 template<
typename _Fp,
typename _Tp1>
2456 static __result_of_success<decltype(
2457 std::declval<_Tp1>().*std::declval<_Fp>()
2458 ), __invoke_memobj_ref> _S_test(
int);
2460 template<
typename,
typename>
2461 static __failure_type _S_test(...);
2464 template<
typename _MemPtr,
typename _Arg>
2465 struct __result_of_memobj_ref
2466 :
private __result_of_memobj_ref_impl
2468 typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2472 struct __result_of_memobj_deref_impl
2474 template<
typename _Fp,
typename _Tp1>
2475 static __result_of_success<decltype(
2476 (*std::declval<_Tp1>()).*std::declval<_Fp>()
2477 ), __invoke_memobj_deref> _S_test(
int);
2479 template<
typename,
typename>
2480 static __failure_type _S_test(...);
2483 template<
typename _MemPtr,
typename _Arg>
2484 struct __result_of_memobj_deref
2485 :
private __result_of_memobj_deref_impl
2487 typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2490 template<typename _MemPtr, typename _Arg>
2491 struct __result_of_memobj;
2493 template<typename _Res, typename _Class, typename _Arg>
2494 struct __result_of_memobj<_Res _Class::*, _Arg>
2496 typedef __remove_cvref_t<_Arg> _Argval;
2497 typedef _Res _Class::* _MemPtr;
2498 typedef typename __conditional_t<__or_<is_same<_Argval, _Class>,
2499 is_base_of<_Class, _Argval>>::value,
2500 __result_of_memobj_ref<_MemPtr, _Arg>,
2501 __result_of_memobj_deref<_MemPtr, _Arg>
2505 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2506 struct __result_of_memfun;
2508 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2509 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2511 typedef typename remove_reference<_Arg>::type _Argval;
2512 typedef _Res _Class::* _MemPtr;
2513 typedef typename __conditional_t<is_base_of<_Class, _Argval>::value,
2514 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2515 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2524 template<
typename _Tp,
typename _Up = __remove_cvref_t<_Tp>>
2530 template<
typename _Tp,
typename _Up>
2531 struct __inv_unwrap<_Tp, reference_wrapper<_Up>>
2536 template<bool, bool,
typename _Functor,
typename... _ArgTypes>
2537 struct __result_of_impl
2539 typedef __failure_type type;
2542 template<
typename _MemPtr,
typename _Arg>
2543 struct __result_of_impl<true, false, _MemPtr, _Arg>
2544 :
public __result_of_memobj<__decay_t<_MemPtr>,
2545 typename __inv_unwrap<_Arg>::type>
2548 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2549 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2550 :
public __result_of_memfun<__decay_t<_MemPtr>,
2551 typename __inv_unwrap<_Arg>::type, _Args...>
2555 struct __result_of_other_impl
2557 template<
typename _Fn,
typename... _Args>
2558 static __result_of_success<decltype(
2559 std::declval<_Fn>()(std::declval<_Args>()...)
2560 ), __invoke_other> _S_test(
int);
2562 template<
typename...>
2563 static __failure_type _S_test(...);
2566 template<
typename _Functor,
typename... _ArgTypes>
2567 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2568 :
private __result_of_other_impl
2570 typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type;
2574 template<typename _Functor, typename... _ArgTypes>
2575 struct __invoke_result
2576 : public __result_of_impl<
2577 is_member_object_pointer<
2578 typename remove_reference<_Functor>::type
2580 is_member_function_pointer<
2581 typename remove_reference<_Functor>::type
2583 _Functor, _ArgTypes...
2588 template<
typename _Functor,
typename... _ArgTypes>
2589 struct result_of<_Functor(_ArgTypes...)>
2590 :
public __invoke_result<_Functor, _ArgTypes...>
2591 { } _GLIBCXX17_DEPRECATED_SUGGEST(
"std::invoke_result");
2593 #if __cplusplus >= 201402L
2595 template<
size_t _Len,
size_t _Align =
2596 __alignof__(
typename __aligned_storage_msa<_Len>::__type)>
2599 template <
size_t _Len,
typename... _Types>
2600 using aligned_union_t =
typename aligned_union<_Len, _Types...>::type;
2603 template<
typename _Tp>
2607 template<
bool _Cond,
typename _Tp =
void>
2611 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2615 template<
typename... _Tp>
2619 template<
typename _Tp>
2623 template<
typename _Tp>
2627 #if __cplusplus >= 201703L || !defined(__STRICT_ANSI__)
2628 #define __cpp_lib_void_t 201411L
2636 template<
typename _Default,
typename _AlwaysVoid,
2637 template<
typename...>
class _Op,
typename... _Args>
2641 using type = _Default;
2645 template<
typename _Default,
template<
typename...>
class _Op,
2647 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
2650 using type = _Op<_Args...>;
2654 template<
typename _Default,
template<
typename...>
class _Op,
2656 using __detected_or = __detector<_Default, void, _Op, _Args...>;
2659 template<
typename _Default,
template<
typename...>
class _Op,
2661 using __detected_or_t
2662 =
typename __detected_or<_Default, _Op, _Args...>::type;
2668 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
2669 template<typename _Tp, typename = __void_t<>> \
2670 struct __has_##_NTYPE \
2673 template<typename _Tp> \
2674 struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
2678 template <
typename _Tp>
2679 struct __is_swappable;
2681 template <
typename _Tp>
2682 struct __is_nothrow_swappable;
2689 template<
typename _Tp>
2690 struct __is_tuple_like
2691 :
public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type
2695 template<
typename _Tp>
2696 _GLIBCXX20_CONSTEXPR
2698 _Require<__not_<__is_tuple_like<_Tp>>,
2699 is_move_constructible<_Tp>,
2700 is_move_assignable<_Tp>>
2702 noexcept(__and_<is_nothrow_move_constructible<_Tp>,
2703 is_nothrow_move_assignable<_Tp>>::value);
2705 template<
typename _Tp,
size_t _Nm>
2706 _GLIBCXX20_CONSTEXPR
2708 __enable_if_t<__is_swappable<_Tp>::value>
2709 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
2710 noexcept(__is_nothrow_swappable<_Tp>::value);
2713 namespace __swappable_details {
2716 struct __do_is_swappable_impl
2718 template<
typename _Tp,
typename
2719 = decltype(
swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
2726 struct __do_is_nothrow_swappable_impl
2728 template<
typename _Tp>
2729 static __bool_constant<
2730 noexcept(
swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
2739 template<
typename _Tp>
2740 struct __is_swappable_impl
2741 :
public __swappable_details::__do_is_swappable_impl
2743 typedef decltype(__test<_Tp>(0)) type;
2746 template<typename _Tp>
2747 struct __is_nothrow_swappable_impl
2748 : public __swappable_details::__do_is_nothrow_swappable_impl
2750 typedef decltype(__test<_Tp>(0)) type;
2753 template<typename _Tp>
2754 struct __is_swappable
2755 : public __is_swappable_impl<_Tp>::type
2758 template<
typename _Tp>
2759 struct __is_nothrow_swappable
2760 :
public __is_nothrow_swappable_impl<_Tp>::type
2764 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
2765 #define __cpp_lib_is_swappable 201603L
2769 template<
typename _Tp>
2771 :
public __is_swappable_impl<_Tp>::type
2773 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
2774 "template argument must be a complete class or an unbounded array");
2778 template<
typename _Tp>
2780 :
public __is_nothrow_swappable_impl<_Tp>::type
2782 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
2783 "template argument must be a complete class or an unbounded array");
2786 #if __cplusplus >= 201402L
2788 template<
typename _Tp>
2793 template<
typename _Tp>
2799 namespace __swappable_with_details {
2802 struct __do_is_swappable_with_impl
2804 template<
typename _Tp,
typename _Up,
typename
2805 = decltype(
swap(std::declval<_Tp>(), std::declval<_Up>())),
2807 = decltype(
swap(std::declval<_Up>(), std::declval<_Tp>()))>
2810 template<
typename,
typename>
2814 struct __do_is_nothrow_swappable_with_impl
2816 template<
typename _Tp,
typename _Up>
2817 static __bool_constant<
2818 noexcept(
swap(std::declval<_Tp>(), std::declval<_Up>()))
2820 noexcept(
swap(std::declval<_Up>(), std::declval<_Tp>()))
2823 template<
typename,
typename>
2829 template<
typename _Tp,
typename _Up>
2830 struct __is_swappable_with_impl
2831 :
public __swappable_with_details::__do_is_swappable_with_impl
2833 typedef decltype(__test<_Tp, _Up>(0)) type;
2837 template<typename _Tp>
2838 struct __is_swappable_with_impl<_Tp&, _Tp&>
2839 : public __swappable_details::__do_is_swappable_impl
2841 typedef decltype(__test<_Tp&>(0)) type;
2844 template<typename _Tp, typename _Up>
2845 struct __is_nothrow_swappable_with_impl
2846 : public __swappable_with_details::__do_is_nothrow_swappable_with_impl
2848 typedef decltype(__test<_Tp, _Up>(0)) type;
2852 template<typename _Tp>
2853 struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
2854 : public __swappable_details::__do_is_nothrow_swappable_impl
2856 typedef decltype(__test<_Tp&>(0)) type;
2861 template<typename _Tp, typename _Up>
2863 : public __is_swappable_with_impl<_Tp, _Up>::type
2865 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
2866 "first template argument must be a complete class or an unbounded array");
2867 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
2868 "second template argument must be a complete class or an unbounded array");
2872 template<
typename _Tp,
typename _Up>
2874 :
public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
2876 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
2877 "first template argument must be a complete class or an unbounded array");
2878 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
2879 "second template argument must be a complete class or an unbounded array");
2882 #if __cplusplus >= 201402L
2884 template<
typename _Tp,
typename _Up>
2889 template<
typename _Tp,
typename _Up>
2901 template<
typename _Result,
typename _Ret,
2903 struct __is_invocable_impl
2910 template<
typename _Result,
typename _Ret>
2911 struct __is_invocable_impl<_Result, _Ret,
2913 __void_t<typename _Result::type>>
2919 #pragma GCC diagnostic push
2920 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
2922 template<
typename _Result,
typename _Ret>
2923 struct __is_invocable_impl<_Result, _Ret,
2925 __void_t<typename _Result::type>>
2931 static typename _Result::type _S_get() noexcept;
2933 template<typename _Tp>
2934 static
void _S_conv(_Tp) noexcept;
2937 template<typename _Tp,
bool _Check_Noex = false,
2938 typename = decltype(_S_conv<_Tp>(_S_get())),
2939 bool _Noex = noexcept(_S_conv<_Tp>(_S_get()))>
2940 static __bool_constant<_Check_Noex ? _Noex : true>
2943 template<typename _Tp,
bool = false>
2949 using type = decltype(_S_test<_Ret>(1));
2952 using __nothrow_type = decltype(_S_test<_Ret, true>(1));
2954 #pragma GCC diagnostic pop
2956 template<
typename _Fn,
typename... _ArgTypes>
2957 struct __is_invocable
2958 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
2961 template<
typename _Fn,
typename _Tp,
typename... _Args>
2962 constexpr
bool __call_is_nt(__invoke_memfun_ref)
2964 using _Up =
typename __inv_unwrap<_Tp>::type;
2965 return noexcept((std::declval<_Up>().*std::declval<_Fn>())(
2966 std::declval<_Args>()...));
2969 template<
typename _Fn,
typename _Tp,
typename... _Args>
2970 constexpr
bool __call_is_nt(__invoke_memfun_deref)
2972 return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())(
2973 std::declval<_Args>()...));
2976 template<
typename _Fn,
typename _Tp>
2977 constexpr
bool __call_is_nt(__invoke_memobj_ref)
2979 using _Up =
typename __inv_unwrap<_Tp>::type;
2980 return noexcept(std::declval<_Up>().*std::declval<_Fn>());
2983 template<
typename _Fn,
typename _Tp>
2984 constexpr
bool __call_is_nt(__invoke_memobj_deref)
2986 return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>());
2989 template<
typename _Fn,
typename... _Args>
2990 constexpr
bool __call_is_nt(__invoke_other)
2992 return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
2995 template<
typename _Result,
typename _Fn,
typename... _Args>
2996 struct __call_is_nothrow
2998 std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
3002 template<
typename _Fn,
typename... _Args>
3003 using __call_is_nothrow_
3004 = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
3007 template<
typename _Fn,
typename... _Args>
3008 struct __is_nothrow_invocable
3009 : __and_<__is_invocable<_Fn, _Args...>,
3010 __call_is_nothrow_<_Fn, _Args...>>::type
3013 #pragma GCC diagnostic push
3014 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3015 struct __nonesuchbase {};
3016 struct __nonesuch :
private __nonesuchbase {
3017 ~__nonesuch() =
delete;
3018 __nonesuch(__nonesuch
const&) =
delete;
3019 void operator=(__nonesuch
const&) =
delete;
3021 #pragma GCC diagnostic pop
3024 #if __cplusplus >= 201703L
3025 # define __cpp_lib_is_invocable 201703L
3028 template<
typename _Functor,
typename... _ArgTypes>
3030 :
public __invoke_result<_Functor, _ArgTypes...>
3032 static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
3033 "_Functor must be a complete class or an unbounded array");
3034 static_assert((std::__is_complete_or_unbounded(
3035 __type_identity<_ArgTypes>{}) && ...),
3036 "each argument type must be a complete class or an unbounded array");
3040 template<
typename _Fn,
typename... _Args>
3044 template<
typename _Fn,
typename... _ArgTypes>
3046 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3048 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3049 "_Fn must be a complete class or an unbounded array");
3050 static_assert((std::__is_complete_or_unbounded(
3051 __type_identity<_ArgTypes>{}) && ...),
3052 "each argument type must be a complete class or an unbounded array");
3056 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3058 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
3060 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3061 "_Fn must be a complete class or an unbounded array");
3062 static_assert((std::__is_complete_or_unbounded(
3063 __type_identity<_ArgTypes>{}) && ...),
3064 "each argument type must be a complete class or an unbounded array");
3065 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3066 "_Ret must be a complete class or an unbounded array");
3070 template<
typename _Fn,
typename... _ArgTypes>
3072 : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
3073 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3075 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3076 "_Fn must be a complete class or an unbounded array");
3077 static_assert((std::__is_complete_or_unbounded(
3078 __type_identity<_ArgTypes>{}) && ...),
3079 "each argument type must be a complete class or an unbounded array");
3083 template<
typename _Result,
typename _Ret>
3084 using __is_nt_invocable_impl
3085 =
typename __is_invocable_impl<_Result, _Ret>::__nothrow_type;
3089 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3091 : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
3092 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3094 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3095 "_Fn must be a complete class or an unbounded array");
3096 static_assert((std::__is_complete_or_unbounded(
3097 __type_identity<_ArgTypes>{}) && ...),
3098 "each argument type must be a complete class or an unbounded array");
3099 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3100 "_Ret must be a complete class or an unbounded array");
3104 #if __cplusplus >= 201703L
3105 # define __cpp_lib_type_trait_variable_templates 201510L
3120 template <
typename _Tp>
3122 template <
typename _Tp>
3124 template <
typename _Tp>
3126 template <
typename _Tp>
3128 template <
typename _Tp>
3130 template <
typename _Tp>
3132 template <
typename _Tp>
3133 inline constexpr
bool is_lvalue_reference_v =
3135 template <
typename _Tp>
3136 inline constexpr
bool is_rvalue_reference_v =
3138 template <
typename _Tp>
3139 inline constexpr
bool is_member_object_pointer_v =
3141 template <
typename _Tp>
3142 inline constexpr
bool is_member_function_pointer_v =
3144 template <
typename _Tp>
3146 template <
typename _Tp>
3148 template <
typename _Tp>
3150 template <
typename _Tp>
3152 template <
typename _Tp>
3154 template <
typename _Tp>
3156 template <
typename _Tp>
3158 template <
typename _Tp>
3160 template <
typename _Tp>
3162 template <
typename _Tp>
3164 template <
typename _Tp>
3166 template <
typename _Tp>
3168 template <
typename _Tp>
3170 template <
typename _Tp>
3172 template <
typename _Tp>
3173 inline constexpr
bool is_trivially_copyable_v =
3175 template <
typename _Tp>
3177 #pragma GCC diagnostic push
3178 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
3179 template <
typename _Tp>
3180 _GLIBCXX20_DEPRECATED(
"use is_standard_layout_v && is_trivial_v instead")
3181 inline constexpr
bool is_pod_v =
is_pod<_Tp>::value;
3182 template <typename _Tp>
3183 _GLIBCXX17_DEPRECATED
3184 inline constexpr
bool is_literal_type_v =
is_literal_type<_Tp>::value;
3185 #pragma GCC diagnostic pop
3186 template <
typename _Tp>
3188 template <
typename _Tp>
3190 template <
typename _Tp>
3192 template <
typename _Tp>
3194 template <
typename _Tp>
3196 template <
typename _Tp>
3198 template <
typename _Tp,
typename... _Args>
3199 inline constexpr
bool is_constructible_v =
3201 template <
typename _Tp>
3202 inline constexpr
bool is_default_constructible_v =
3204 template <
typename _Tp>
3205 inline constexpr
bool is_copy_constructible_v =
3207 template <
typename _Tp>
3208 inline constexpr
bool is_move_constructible_v =
3210 template <
typename _Tp,
typename _Up>
3212 template <
typename _Tp>
3214 template <
typename _Tp>
3216 template <
typename _Tp>
3218 template <
typename _Tp,
typename... _Args>
3219 inline constexpr
bool is_trivially_constructible_v =
3221 template <
typename _Tp>
3222 inline constexpr
bool is_trivially_default_constructible_v =
3224 template <
typename _Tp>
3225 inline constexpr
bool is_trivially_copy_constructible_v =
3227 template <
typename _Tp>
3228 inline constexpr
bool is_trivially_move_constructible_v =
3230 template <
typename _Tp,
typename _Up>
3231 inline constexpr
bool is_trivially_assignable_v =
3233 template <
typename _Tp>
3234 inline constexpr
bool is_trivially_copy_assignable_v =
3236 template <
typename _Tp>
3237 inline constexpr
bool is_trivially_move_assignable_v =
3239 template <
typename _Tp>
3240 inline constexpr
bool is_trivially_destructible_v =
3242 template <
typename _Tp,
typename... _Args>
3243 inline constexpr
bool is_nothrow_constructible_v =
3245 template <
typename _Tp>
3246 inline constexpr
bool is_nothrow_default_constructible_v =
3248 template <
typename _Tp>
3249 inline constexpr
bool is_nothrow_copy_constructible_v =
3251 template <
typename _Tp>
3252 inline constexpr
bool is_nothrow_move_constructible_v =
3254 template <
typename _Tp,
typename _Up>
3255 inline constexpr
bool is_nothrow_assignable_v =
3257 template <
typename _Tp>
3258 inline constexpr
bool is_nothrow_copy_assignable_v =
3260 template <
typename _Tp>
3261 inline constexpr
bool is_nothrow_move_assignable_v =
3263 template <
typename _Tp>
3264 inline constexpr
bool is_nothrow_destructible_v =
3266 template <
typename _Tp>
3267 inline constexpr
bool has_virtual_destructor_v =
3269 template <
typename _Tp>
3271 template <
typename _Tp>
3273 template <
typename _Tp,
unsigned _Idx = 0>
3275 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME
3276 template <
typename _Tp,
typename _Up>
3277 inline constexpr
bool is_same_v = __is_same(_Tp, _Up);
3279 template <
typename _Tp,
typename _Up>
3282 template <
typename _Base,
typename _Derived>
3284 template <
typename _From,
typename _To>
3286 template<
typename _Fn,
typename... _Args>
3287 inline constexpr
bool is_invocable_v =
is_invocable<_Fn, _Args...>::value;
3288 template<
typename _Fn,
typename... _Args>
3289 inline constexpr
bool is_nothrow_invocable_v
3291 template<
typename _Ret,
typename _Fn,
typename... _Args>
3292 inline constexpr
bool is_invocable_r_v
3294 template<
typename _Ret,
typename _Fn,
typename... _Args>
3295 inline constexpr
bool is_nothrow_invocable_r_v
3299 #ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
3300 # define __cpp_lib_has_unique_object_representations 201606L
3303 template<
typename _Tp>
3306 remove_cv_t<remove_all_extents_t<_Tp>>
3309 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3310 "template argument must be a complete class or an unbounded array");
3314 template<
typename _Tp>
3315 inline constexpr
bool has_unique_object_representations_v
3319 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
3320 # define __cpp_lib_is_aggregate 201703L
3323 template<
typename _Tp>
3329 template<
typename _Tp>
3334 #if __cplusplus >= 202002L
3340 #define __cpp_lib_remove_cvref 201711L
3342 template<
typename _Tp>
3347 template<
typename _Tp>
3348 struct remove_cvref<_Tp&>
3352 template<
typename _Tp>
3353 struct remove_cvref<_Tp&&>
3357 template<
typename _Tp>
3365 #define __cpp_lib_type_identity 201806L
3366 template<
typename _Tp>
3367 struct type_identity {
using type = _Tp; };
3369 template<
typename _Tp>
3373 #define __cpp_lib_unwrap_ref 201811L
3379 template<
typename _Tp>
3382 template<
typename _Tp>
3385 template<
typename _Tp>
3386 using unwrap_reference_t =
typename unwrap_reference<_Tp>::type;
3393 template<
typename _Tp>
3396 template<
typename _Tp>
3397 using unwrap_ref_decay_t =
typename unwrap_ref_decay<_Tp>::type;
3400 #define __cpp_lib_bounded_array_traits 201902L
3404 template<
typename _Tp>
3406 :
public __is_array_known_bounds<_Tp>
3411 template<
typename _Tp>
3413 :
public __is_array_unknown_bounds<_Tp>
3418 template<
typename _Tp>
3424 template<
typename _Tp>
3428 #if __has_builtin(__is_layout_compatible)
3431 template<
typename _Tp,
typename _Up>
3438 template<
typename _Tp,
typename _Up>
3440 = __is_layout_compatible(_Tp, _Up);
3442 #if __has_builtin(__builtin_is_corresponding_member)
3443 #define __cpp_lib_is_layout_compatible 201907L
3446 template<
typename _S1,
typename _S2,
typename _M1,
typename _M2>
3449 {
return __builtin_is_corresponding_member(__m1, __m2); }
3453 #if __has_builtin(__is_pointer_interconvertible_base_of)
3456 template<
typename _Base,
typename _Derived>
3458 :
bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)>
3463 template<
typename _Base,
typename _Derived>
3465 = __is_pointer_interconvertible_base_of(_Base, _Derived);
3467 #if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
3468 #define __cpp_lib_is_pointer_interconvertible 201907L
3473 template<
typename _Tp,
typename _Mem>
3476 {
return __builtin_is_pointer_interconvertible_with_class(__mp); }
3480 #if __cplusplus > 202002L
3481 #define __cpp_lib_is_scoped_enum 202011L
3486 template<
typename _Tp>
3487 struct is_scoped_enum
3491 template<
typename _Tp>
3492 requires __is_enum(_Tp)
3493 && requires(_Tp __t) { __t = __t; }
3494 struct is_scoped_enum<_Tp>
3495 :
bool_constant<!requires(_Tp __t, void(*__f)(int)) { __f(__t); }>
3500 template<
typename _Tp>
3501 requires __is_enum(_Tp)
3502 && requires(_Tp __t) { __t = __t; }
3503 struct is_scoped_enum<const _Tp>
3504 :
bool_constant<!requires(_Tp __t, void(*__f)(int)) { __f(__t); }>
3509 template<
typename _Tp>
3510 inline constexpr
bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
3514 #if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
3515 #define __cpp_lib_is_constant_evaluated 201811L
3519 constexpr
inline bool
3522 #if __cpp_if_consteval >= 202106L
3523 if consteval {
return true; }
else {
return false; }
3525 return __builtin_is_constant_evaluated();
3531 template<
typename _From,
typename _To>
3532 using __copy_cv =
typename __match_cv_qualifiers<_From, _To>::__type;
3534 template<
typename _Xp,
typename _Yp>
3536 = decltype(
false ?
declval<_Xp(&)()>()() :
declval<_Yp(&)()>()());
3538 template<
typename _Ap,
typename _Bp,
typename =
void>
3539 struct __common_ref_impl
3543 template<
typename _Ap,
typename _Bp>
3544 using __common_ref =
typename __common_ref_impl<_Ap, _Bp>::type;
3547 template<
typename _Xp,
typename _Yp>
3548 using __condres_cvref
3549 = __cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>;
3552 template<
typename _Xp,
typename _Yp>
3553 struct __common_ref_impl<_Xp&, _Yp&, __void_t<__condres_cvref<_Xp, _Yp>>>
3554 : enable_if<is_reference_v<__condres_cvref<_Xp, _Yp>>,
3555 __condres_cvref<_Xp, _Yp>>
3559 template<
typename _Xp,
typename _Yp>
3560 using __common_ref_C = remove_reference_t<__common_ref<_Xp&, _Yp&>>&&;
3563 template<
typename _Xp,
typename _Yp>
3564 struct __common_ref_impl<_Xp&&, _Yp&&,
3565 _Require<is_convertible<_Xp&&, __common_ref_C<_Xp, _Yp>>,
3566 is_convertible<_Yp&&, __common_ref_C<_Xp, _Yp>>>>
3567 {
using type = __common_ref_C<_Xp, _Yp>; };
3570 template<
typename _Xp,
typename _Yp>
3571 using __common_ref_D = __common_ref<const _Xp&, _Yp&>;
3574 template<
typename _Xp,
typename _Yp>
3575 struct __common_ref_impl<_Xp&&, _Yp&,
3576 _Require<is_convertible<_Xp&&, __common_ref_D<_Xp, _Yp>>>>
3577 {
using type = __common_ref_D<_Xp, _Yp>; };
3580 template<
typename _Xp,
typename _Yp>
3581 struct __common_ref_impl<_Xp&, _Yp&&>
3582 : __common_ref_impl<_Yp&&, _Xp&>
3586 template<
typename _Tp,
typename _Up,
3587 template<
typename>
class _TQual,
template<
typename>
class _UQual>
3588 struct basic_common_reference
3592 template<
typename _Tp>
3594 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>; };
3596 template<
typename _Tp>
3598 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&; };
3600 template<
typename _Tp>
3601 struct __xref<_Tp&&>
3602 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&&; };
3604 template<
typename _Tp1,
typename _Tp2>
3605 using __basic_common_ref
3606 =
typename basic_common_reference<remove_cvref_t<_Tp1>,
3607 remove_cvref_t<_Tp2>,
3608 __xref<_Tp1>::template __type,
3609 __xref<_Tp2>::template __type>::type;
3612 template<
typename... _Tp>
3613 struct common_reference;
3615 template<
typename... _Tp>
3616 using common_reference_t =
typename common_reference<_Tp...>::type;
3620 struct common_reference<>
3624 template<
typename _Tp0>
3625 struct common_reference<_Tp0>
3626 {
using type = _Tp0; };
3629 template<
typename _Tp1,
typename _Tp2,
int _Bullet = 1,
typename =
void>
3630 struct __common_reference_impl
3631 : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1>
3635 template<
typename _Tp1,
typename _Tp2>
3636 struct common_reference<_Tp1, _Tp2>
3637 : __common_reference_impl<_Tp1, _Tp2>
3641 template<
typename _Tp1,
typename _Tp2>
3642 struct __common_reference_impl<_Tp1&, _Tp2&, 1,
3643 void_t<__common_ref<_Tp1&, _Tp2&>>>
3644 {
using type = __common_ref<_Tp1&, _Tp2&>; };
3646 template<
typename _Tp1,
typename _Tp2>
3647 struct __common_reference_impl<_Tp1&&, _Tp2&&, 1,
3648 void_t<__common_ref<_Tp1&&, _Tp2&&>>>
3649 {
using type = __common_ref<_Tp1&&, _Tp2&&>; };
3651 template<
typename _Tp1,
typename _Tp2>
3652 struct __common_reference_impl<_Tp1&, _Tp2&&, 1,
3653 void_t<__common_ref<_Tp1&, _Tp2&&>>>
3654 {
using type = __common_ref<_Tp1&, _Tp2&&>; };
3656 template<
typename _Tp1,
typename _Tp2>
3657 struct __common_reference_impl<_Tp1&&, _Tp2&, 1,
3658 void_t<__common_ref<_Tp1&&, _Tp2&>>>
3659 {
using type = __common_ref<_Tp1&&, _Tp2&>; };
3662 template<
typename _Tp1,
typename _Tp2>
3663 struct __common_reference_impl<_Tp1, _Tp2, 2,
3664 void_t<__basic_common_ref<_Tp1, _Tp2>>>
3665 {
using type = __basic_common_ref<_Tp1, _Tp2>; };
3668 template<
typename _Tp1,
typename _Tp2>
3669 struct __common_reference_impl<_Tp1, _Tp2, 3,
3670 void_t<__cond_res<_Tp1, _Tp2>>>
3671 {
using type = __cond_res<_Tp1, _Tp2>; };
3674 template<
typename _Tp1,
typename _Tp2>
3675 struct __common_reference_impl<_Tp1, _Tp2, 4,
3677 {
using type = common_type_t<_Tp1, _Tp2>; };
3680 template<
typename _Tp1,
typename _Tp2>
3681 struct __common_reference_impl<_Tp1, _Tp2, 5, void>
3685 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
3686 struct common_reference<_Tp1, _Tp2, _Rest...>
3687 : __common_type_fold<common_reference<_Tp1, _Tp2>,
3688 __common_type_pack<_Rest...>>
3692 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
3693 struct __common_type_fold<common_reference<_Tp1, _Tp2>,
3694 __common_type_pack<_Rest...>,
3695 void_t<common_reference_t<_Tp1, _Tp2>>>
3696 :
public common_reference<common_reference_t<_Tp1, _Tp2>, _Rest...>
3704 _GLIBCXX_END_NAMESPACE_VERSION
typename type_identity< _Tp >::type type_identity_t
constexpr bool is_corresponding_member(_M1 _S1::*__m1, _M2 _S2::*__m2) noexcept
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
typename result_of< _Tp >::type result_of_t
Alias template for result_of.
constexpr bool is_nothrow_swappable_v
is_nothrow_swappable_v
typename add_rvalue_reference< _Tp >::type add_rvalue_reference_t
Alias template for add_rvalue_reference.
integral_constant< bool, __v > bool_constant
Alias template for compile-time boolean constant types.
constexpr bool is_nothrow_convertible_v
is_nothrow_convertible_v
typename make_unsigned< _Tp >::type make_unsigned_t
Alias template for make_unsigned.
void void_t
A metafunction that always yields void, used for detecting valid types.
constexpr bool is_swappable_v
is_swappable_v
typename aligned_storage< _Len, _Align >::type aligned_storage_t
Alias template for aligned_storage.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
typename remove_cv< _Tp >::type remove_cv_t
Alias template for remove_cv.
typename remove_all_extents< _Tp >::type remove_all_extents_t
Alias template for remove_all_extents.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
typename conditional< _Cond, _Iftrue, _Iffalse >::type conditional_t
Alias template for conditional.
typename add_const< _Tp >::type add_const_t
Alias template for add_const.
typename remove_pointer< _Tp >::type remove_pointer_t
Alias template for remove_pointer.
typename add_cv< _Tp >::type add_cv_t
Alias template for add_cv.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
typename remove_const< _Tp >::type remove_const_t
Alias template for remove_const.
constexpr bool is_swappable_with_v
is_swappable_with_v
typename add_volatile< _Tp >::type add_volatile_t
Alias template for add_volatile.
typename remove_volatile< _Tp >::type remove_volatile_t
Alias template for remove_volatile.
typename add_lvalue_reference< _Tp >::type add_lvalue_reference_t
Alias template for add_lvalue_reference.
typename remove_cvref< _Tp >::type remove_cvref_t
typename add_pointer< _Tp >::type add_pointer_t
Alias template for add_pointer.
typename remove_extent< _Tp >::type remove_extent_t
Alias template for remove_extent.
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
typename underlying_type< _Tp >::type underlying_type_t
Alias template for underlying_type.
typename decay< _Tp >::type decay_t
Alias template for decay.
typename make_signed< _Tp >::type make_signed_t
Alias template for make_signed.
constexpr bool is_pointer_interconvertible_with_class(_Mem _Tp::*__mp) noexcept
True if __mp points to the first member of a standard-layout type.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
typename invoke_result< _Fn, _Args... >::type invoke_result_t
std::invoke_result_t
constexpr bool is_nothrow_swappable_with_v
is_nothrow_swappable_with_v
constexpr bool is_bounded_array_v
constexpr bool is_unbounded_array_v
constexpr bool is_layout_compatible_v
constexpr bool is_pointer_interconvertible_base_of_v
auto declval() noexcept -> decltype(__declval< _Tp >(0))
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
ISO C++ entities toplevel namespace is std.
Primary class template for reference_wrapper.
is_member_function_pointer
is_null_pointer (LWG 2247).
__is_nullptr_t (deprecated extension).
is_nothrow_default_constructible
is_nothrow_copy_constructible
is_nothrow_move_constructible
is_nothrow_copy_assignable
is_nothrow_move_assignable
is_trivially_constructible
is_trivially_default_constructible
is_trivially_copy_constructible
is_trivially_move_constructible
is_trivially_copy_assignable
is_trivially_move_assignable
is_trivially_destructible
Provide aligned storage for types.
aligned_storage< _S_len, alignment_value >::type type
The storage.
Define a member typedef type only if a boolean constant is true.
Define a member typedef type to one of two argument types.
The underlying type of an enum.
Metafunctions used for detecting swappable types: p0185r1.
is_nothrow_swappable_with
std::is_nothrow_invocable
std::is_nothrow_invocable_r
has_unique_object_representations
True for a type that is an array of known bound.
True for a type that is an array of unknown bound.
True if _Derived is standard-layout and has a base class of type _Base