29#ifndef _GLIBCXX_TYPE_TRAITS
30#define _GLIBCXX_TYPE_TRAITS 1
33#pragma GCC system_header
36#if __cplusplus < 201103L
42#define __glibcxx_want_bool_constant
43#define __glibcxx_want_bounded_array_traits
44#define __glibcxx_want_has_unique_object_representations
45#define __glibcxx_want_integral_constant_callable
46#define __glibcxx_want_is_aggregate
47#define __glibcxx_want_is_constant_evaluated
48#define __glibcxx_want_is_final
49#define __glibcxx_want_is_invocable
50#define __glibcxx_want_is_layout_compatible
51#define __glibcxx_want_is_nothrow_convertible
52#define __glibcxx_want_is_null_pointer
53#define __glibcxx_want_is_pointer_interconvertible
54#define __glibcxx_want_is_scoped_enum
55#define __glibcxx_want_is_swappable
56#define __glibcxx_want_is_virtual_base_of
57#define __glibcxx_want_logical_traits
58#define __glibcxx_want_reference_from_temporary
59#define __glibcxx_want_remove_cvref
60#define __glibcxx_want_result_of_sfinae
61#define __glibcxx_want_transformation_trait_aliases
62#define __glibcxx_want_type_identity
63#define __glibcxx_want_type_trait_variable_templates
64#define __glibcxx_want_unwrap_ref
65#define __glibcxx_want_void_t
70namespace std _GLIBCXX_VISIBILITY(default)
72_GLIBCXX_BEGIN_NAMESPACE_VERSION
74 template<
typename _Tp>
75 class reference_wrapper;
91 template<
typename _Tp, _Tp __v>
94 static constexpr _Tp value = __v;
95 using value_type = _Tp;
97 constexpr operator value_type()
const noexcept {
return value; }
99#ifdef __cpp_lib_integral_constant_callable
100 constexpr value_type operator()()
const noexcept {
return value; }
104#if ! __cpp_inline_variables
105 template<
typename _Tp, _Tp __v>
121#ifdef __cpp_lib_bool_constant
125 using bool_constant = __bool_constant<__v>;
132 template<
bool,
typename _Tp =
void>
137 template<
typename _Tp>
139 {
using type = _Tp; };
142 template<
bool _Cond,
typename _Tp =
void>
143 using __enable_if_t =
typename enable_if<_Cond, _Tp>::type;
148 template<
typename _Tp,
typename>
153 struct __conditional<false>
155 template<
typename,
typename _Up>
160 template<
bool _Cond,
typename _If,
typename _Else>
161 using __conditional_t
162 =
typename __conditional<_Cond>::template type<_If, _Else>;
165 template <
typename _Type>
166 struct __type_identity
167 {
using type = _Type; };
169 template<
typename _Tp>
170 using __type_identity_t =
typename __type_identity<_Tp>::type;
175 template<
typename _Tp,
typename...>
176 using __first_t = _Tp;
179 template<
typename... _Bn>
181 __enable_if_t<!bool(_Bn::value)>...>;
183 template<
typename... _Bn>
186 template<
typename... _Bn>
187 auto __and_fn(
int) -> __first_t<
true_type,
188 __enable_if_t<bool(_Bn::value)>...>;
190 template<
typename... _Bn>
197 template<
typename... _Bn>
199 : decltype(__detail::__or_fn<_Bn...>(0))
202 template<
typename... _Bn>
204 : decltype(__detail::__and_fn<_Bn...>(0))
207 template<
typename _Pp>
209 : __bool_constant<!bool(_Pp::value)>
213#ifdef __cpp_lib_logical_traits
216 template<
typename... _Bn>
217 inline constexpr bool __or_v = __or_<_Bn...>::value;
218 template<
typename... _Bn>
219 inline constexpr bool __and_v = __and_<_Bn...>::value;
223 template<
typename ,
typename _B1,
typename... _Bn>
224 struct __disjunction_impl
225 {
using type = _B1; };
227 template<
typename _B1,
typename _B2,
typename... _Bn>
228 struct __disjunction_impl<__enable_if_t<!bool(_B1::value)>, _B1, _B2, _Bn...>
229 {
using type =
typename __disjunction_impl<void, _B2, _Bn...>::type; };
231 template<
typename ,
typename _B1,
typename... _Bn>
232 struct __conjunction_impl
233 {
using type = _B1; };
235 template<
typename _B1,
typename _B2,
typename... _Bn>
236 struct __conjunction_impl<__enable_if_t<bool(_B1::value)>, _B1, _B2, _Bn...>
237 {
using type =
typename __conjunction_impl<void, _B2, _Bn...>::type; };
241 template<
typename... _Bn>
243 : __detail::__conjunction_impl<void, _Bn...>::type
251 template<
typename... _Bn>
253 : __detail::__disjunction_impl<void, _Bn...>::type
261 template<
typename _Pp>
269 template<
typename... _Bn>
270 inline constexpr bool conjunction_v = conjunction<_Bn...>::value;
272 template<
typename... _Bn>
273 inline constexpr bool disjunction_v = disjunction<_Bn...>::value;
275 template<
typename _Pp>
276 inline constexpr bool negation_v = negation<_Pp>::value;
295 struct __is_array_unknown_bounds;
300 template <
typename _Tp,
size_t = sizeof(_Tp)>
301 constexpr true_type __is_complete_or_unbounded(__type_identity<_Tp>)
304 template <
typename _TypeIdentity,
305 typename _NestedType =
typename _TypeIdentity::type>
306 constexpr typename __or_<
307 is_reference<_NestedType>,
308 is_function<_NestedType>,
309 is_void<_NestedType>,
310 __is_array_unknown_bounds<_NestedType>
311 >::type __is_complete_or_unbounded(_TypeIdentity)
315 template<
typename _Tp>
316 using __remove_cv_t =
typename remove_cv<_Tp>::type;
322 template<
typename _Tp>
331 struct is_void<const void>
335 struct is_void<volatile void>
339 struct is_void<const volatile void>
344 struct __is_integral_helper
348 struct __is_integral_helper<bool>
352 struct __is_integral_helper<char>
356 struct __is_integral_helper<signed char>
360 struct __is_integral_helper<unsigned char>
367 struct __is_integral_helper<wchar_t>
370#ifdef _GLIBCXX_USE_CHAR8_T
372 struct __is_integral_helper<char8_t>
377 struct __is_integral_helper<char16_t>
381 struct __is_integral_helper<char32_t>
385 struct __is_integral_helper<short>
389 struct __is_integral_helper<unsigned short>
393 struct __is_integral_helper<int>
397 struct __is_integral_helper<unsigned int>
401 struct __is_integral_helper<long>
405 struct __is_integral_helper<unsigned long>
409 struct __is_integral_helper<long long>
413 struct __is_integral_helper<unsigned long long>
418#if defined(__GLIBCXX_TYPE_INT_N_0)
421 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
426 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
429#if defined(__GLIBCXX_TYPE_INT_N_1)
432 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
437 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
440#if defined(__GLIBCXX_TYPE_INT_N_2)
443 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
448 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
451#if defined(__GLIBCXX_TYPE_INT_N_3)
454 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
459 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
465 template<
typename _Tp>
467 :
public __is_integral_helper<__remove_cv_t<_Tp>>::type
472 struct __is_floating_point_helper
476 struct __is_floating_point_helper<float>
480 struct __is_floating_point_helper<double>
484 struct __is_floating_point_helper<long double>
487#ifdef __STDCPP_FLOAT16_T__
489 struct __is_floating_point_helper<_Float16>
493#ifdef __STDCPP_FLOAT32_T__
495 struct __is_floating_point_helper<_Float32>
499#ifdef __STDCPP_FLOAT64_T__
501 struct __is_floating_point_helper<_Float64>
505#ifdef __STDCPP_FLOAT128_T__
507 struct __is_floating_point_helper<_Float128>
511#ifdef __STDCPP_BFLOAT16_T__
513 struct __is_floating_point_helper<
__gnu_cxx::__bfloat16_t>
517#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) && !defined(__CUDACC__)
519 struct __is_floating_point_helper<__float128>
525 template<
typename _Tp>
527 :
public __is_floating_point_helper<__remove_cv_t<_Tp>>::type
531#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
532 template<
typename _Tp>
534 :
public __bool_constant<__is_array(_Tp)>
541 template<
typename _Tp, std::
size_t _Size>
545 template<
typename _Tp>
546 struct is_array<_Tp[]>
551#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
552 template<
typename _Tp>
554 :
public __bool_constant<__is_pointer(_Tp)>
557 template<
typename _Tp>
561 template<
typename _Tp>
565 template<
typename _Tp>
566 struct is_pointer<_Tp*
const>
569 template<
typename _Tp>
570 struct is_pointer<_Tp*
volatile>
573 template<
typename _Tp>
574 struct is_pointer<_Tp*
const volatile>
583 template<
typename _Tp>
592 template<
typename _Tp>
597#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
598 template<
typename _Tp>
599 struct is_member_object_pointer
600 :
public __bool_constant<__is_member_object_pointer(_Tp)>
607 template<
typename _Tp,
typename _Cp>
609 :
public __not_<is_function<_Tp>>::type { };
612 template<
typename _Tp>
613 struct is_member_object_pointer
614 :
public __is_member_object_pointer_helper<__remove_cv_t<_Tp>>::type
618#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
620 template<
typename _Tp>
621 struct is_member_function_pointer
622 :
public __bool_constant<__is_member_function_pointer(_Tp)>
626 struct __is_member_function_pointer_helper
629 template<
typename _Tp,
typename _Cp>
630 struct __is_member_function_pointer_helper<_Tp _Cp::*>
631 :
public is_function<_Tp>::type { };
634 template<
typename _Tp>
636 :
public __is_member_function_pointer_helper<__remove_cv_t<_Tp>>::type
641 template<
typename _Tp>
643 :
public __bool_constant<__is_enum(_Tp)>
647 template<
typename _Tp>
649 :
public __bool_constant<__is_union(_Tp)>
653 template<
typename _Tp>
655 :
public __bool_constant<__is_class(_Tp)>
659#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
660 template<
typename _Tp>
662 :
public __bool_constant<__is_function(_Tp)>
665 template<
typename _Tp>
667 :
public __bool_constant<!is_const<const _Tp>::value> { };
669 template<
typename _Tp>
673 template<
typename _Tp>
674 struct is_function<_Tp&&>
678#ifdef __cpp_lib_is_null_pointer
680 template<typename _Tp>
681 struct is_null_pointer
685 struct is_null_pointer<
std::nullptr_t>
689 struct is_null_pointer<const
std::nullptr_t>
693 struct is_null_pointer<volatile
std::nullptr_t>
697 struct is_null_pointer<const volatile
std::nullptr_t>
702 template<
typename _Tp>
703 struct __is_nullptr_t
704 :
public is_null_pointer<_Tp>
705 { } _GLIBCXX_DEPRECATED_SUGGEST(
"std::is_null_pointer");
711#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
712 template<
typename _Tp>
714 :
public __bool_constant<__is_reference(_Tp)>
717 template<
typename _Tp>
722 template<
typename _Tp>
727 template<
typename _Tp>
728 struct is_reference<_Tp&&>
734 template<
typename _Tp>
736 :
public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
740 template<
typename _Tp>
742 :
public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
743 is_null_pointer<_Tp>>::type
747#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
748 template<
typename _Tp>
750 :
public __bool_constant<__is_object(_Tp)>
753 template<
typename _Tp>
755 :
public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
764 template<
typename _Tp>
766 :
public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
767 is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
771 template<
typename _Tp>
773 :
public __bool_constant<!is_fundamental<_Tp>::value> { };
776#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
777 template<
typename _Tp>
779 :
public __bool_constant<__is_member_pointer(_Tp)>
783 template<
typename _Tp>
784 struct __is_member_pointer_helper
787 template<
typename _Tp,
typename _Cp>
788 struct __is_member_pointer_helper<_Tp _Cp::*>
792 template<
typename _Tp>
794 :
public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type
798 template<
typename,
typename>
802 template<
typename _Tp,
typename... _Types>
803 using __is_one_of = __or_<is_same<_Tp, _Types>...>;
807 template<
typename _Tp>
808 using __is_signed_integer = __is_one_of<__remove_cv_t<_Tp>,
809 signed char,
signed short,
signed int,
signed long,
811#if defined(__GLIBCXX_TYPE_INT_N_0)
812 ,
signed __GLIBCXX_TYPE_INT_N_0
814#if defined(__GLIBCXX_TYPE_INT_N_1)
815 ,
signed __GLIBCXX_TYPE_INT_N_1
817#if defined(__GLIBCXX_TYPE_INT_N_2)
818 ,
signed __GLIBCXX_TYPE_INT_N_2
820#if defined(__GLIBCXX_TYPE_INT_N_3)
821 ,
signed __GLIBCXX_TYPE_INT_N_3
827 template<
typename _Tp>
828 using __is_unsigned_integer = __is_one_of<__remove_cv_t<_Tp>,
829 unsigned char,
unsigned short,
unsigned int,
unsigned long,
831#if defined(__GLIBCXX_TYPE_INT_N_0)
832 ,
unsigned __GLIBCXX_TYPE_INT_N_0
834#if defined(__GLIBCXX_TYPE_INT_N_1)
835 ,
unsigned __GLIBCXX_TYPE_INT_N_1
837#if defined(__GLIBCXX_TYPE_INT_N_2)
838 ,
unsigned __GLIBCXX_TYPE_INT_N_2
840#if defined(__GLIBCXX_TYPE_INT_N_3)
841 ,
unsigned __GLIBCXX_TYPE_INT_N_3
846 template<
typename _Tp>
847 using __is_standard_integer
848 = __or_<__is_signed_integer<_Tp>, __is_unsigned_integer<_Tp>>;
851 template<
typename...>
using __void_t = void;
857#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
858 template<
typename _Tp>
860 :
public __bool_constant<__is_const(_Tp)>
867 template<
typename _Tp>
873#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
874 template<
typename _Tp>
876 :
public __bool_constant<__is_volatile(_Tp)>
883 template<
typename _Tp>
889 template<
typename _Tp>
891 :
public __bool_constant<__is_trivial(_Tp)>
893 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
894 "template argument must be a complete class or an unbounded array");
898 template<
typename _Tp>
900 :
public __bool_constant<__is_trivially_copyable(_Tp)>
902 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
903 "template argument must be a complete class or an unbounded array");
907 template<
typename _Tp>
909 :
public __bool_constant<__is_standard_layout(_Tp)>
911 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
912 "template argument must be a complete class or an unbounded array");
920 template<
typename _Tp>
922 _GLIBCXX20_DEPRECATED_SUGGEST(
"is_standard_layout && is_trivial")
924 : public __bool_constant<__is_pod(_Tp)>
926 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
927 "template argument must be a complete class or an unbounded array");
934 template<
typename _Tp>
936 _GLIBCXX17_DEPRECATED
938 :
public __bool_constant<__is_literal_type(_Tp)>
940 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
941 "template argument must be a complete class or an unbounded array");
945 template<
typename _Tp>
947 :
public __bool_constant<__is_empty(_Tp)>
951 template<
typename _Tp>
953 :
public __bool_constant<__is_polymorphic(_Tp)>
956#ifdef __cpp_lib_is_final
959 template<typename _Tp>
961 :
public __bool_constant<__is_final(_Tp)>
966 template<
typename _Tp>
968 :
public __bool_constant<__is_abstract(_Tp)>
972 template<
typename _Tp,
974 struct __is_signed_helper
977 template<
typename _Tp>
978 struct __is_signed_helper<_Tp, true>
979 :
public __bool_constant<_Tp(-1) < _Tp(0)>
984 template<typename _Tp>
986 : public __is_signed_helper<_Tp>::type
990 template<typename _Tp>
992 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
996 template<typename _Tp, typename _Up = _Tp&&>
1000 template<typename _Tp>
1005 template<typename _Tp>
1006 auto declval() noexcept -> decltype(__declval<_Tp>(0));
1012 template<typename _Tp>
1013 struct __is_array_known_bounds
1017 template<
typename _Tp,
size_t _Size>
1018 struct __is_array_known_bounds<_Tp[_Size]>
1022 template<
typename _Tp>
1023 struct __is_array_unknown_bounds
1027 template<
typename _Tp>
1028 struct __is_array_unknown_bounds<_Tp[]>
1039 struct __do_is_destructible_impl
1041 template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
1042 static true_type __test(
int);
1048 template<
typename _Tp>
1049 struct __is_destructible_impl
1050 :
public __do_is_destructible_impl
1052 using type =
decltype(__test<_Tp>(0));
1055 template<
typename _Tp,
1056 bool = __or_<is_void<_Tp>,
1057 __is_array_unknown_bounds<_Tp>,
1058 is_function<_Tp>>::value,
1059 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1060 struct __is_destructible_safe;
1062 template<
typename _Tp>
1063 struct __is_destructible_safe<_Tp, false, false>
1064 :
public __is_destructible_impl<typename
1065 remove_all_extents<_Tp>::type>::type
1068 template<
typename _Tp>
1069 struct __is_destructible_safe<_Tp, true, false>
1072 template<
typename _Tp>
1073 struct __is_destructible_safe<_Tp, false, true>
1078 template<
typename _Tp>
1080 :
public __is_destructible_safe<_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");
1092 struct __do_is_nt_destructible_impl
1094 template<
typename _Tp>
1095 static __bool_constant<noexcept(declval<_Tp&>().~_Tp())>
1102 template<
typename _Tp>
1103 struct __is_nt_destructible_impl
1104 :
public __do_is_nt_destructible_impl
1106 using type =
decltype(__test<_Tp>(0));
1109 template<
typename _Tp,
1110 bool = __or_<is_void<_Tp>,
1111 __is_array_unknown_bounds<_Tp>,
1112 is_function<_Tp>>::value,
1113 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1114 struct __is_nt_destructible_safe;
1116 template<
typename _Tp>
1117 struct __is_nt_destructible_safe<_Tp, false, false>
1118 :
public __is_nt_destructible_impl<typename
1119 remove_all_extents<_Tp>::type>::type
1122 template<
typename _Tp>
1123 struct __is_nt_destructible_safe<_Tp, true, false>
1126 template<
typename _Tp>
1127 struct __is_nt_destructible_safe<_Tp, false, true>
1132 template<
typename _Tp>
1134 :
public __is_nt_destructible_safe<_Tp>::type
1136 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1137 "template argument must be a complete class or an unbounded array");
1141 template<
typename _Tp,
typename... _Args>
1142 using __is_constructible_impl
1143 = __bool_constant<__is_constructible(_Tp, _Args...)>;
1147 template<
typename _Tp,
typename... _Args>
1149 :
public __is_constructible_impl<_Tp, _Args...>
1151 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1152 "template argument must be a complete class or an unbounded array");
1156 template<
typename _Tp>
1158 :
public __is_constructible_impl<_Tp>
1160 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1161 "template argument must be a complete class or an unbounded array");
1165#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference)
1166 template<
typename _Tp>
1167 using __add_lval_ref_t = __add_lvalue_reference(_Tp);
1169 template<
typename _Tp,
typename =
void>
1170 struct __add_lvalue_reference_helper
1171 {
using type = _Tp; };
1173 template<
typename _Tp>
1174 struct __add_lvalue_reference_helper<_Tp, __void_t<_Tp&>>
1175 {
using type = _Tp&; };
1177 template<
typename _Tp>
1178 using __add_lval_ref_t =
typename __add_lvalue_reference_helper<_Tp>::type;
1183 template<
typename _Tp>
1185 :
public __is_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1187 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1188 "template argument must be a complete class or an unbounded array");
1192#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_rvalue_reference)
1193 template<
typename _Tp>
1194 using __add_rval_ref_t = __add_rvalue_reference(_Tp);
1196 template<
typename _Tp,
typename =
void>
1197 struct __add_rvalue_reference_helper
1198 {
using type = _Tp; };
1200 template<
typename _Tp>
1201 struct __add_rvalue_reference_helper<_Tp, __void_t<_Tp&&>>
1202 {
using type = _Tp&&; };
1204 template<
typename _Tp>
1205 using __add_rval_ref_t =
typename __add_rvalue_reference_helper<_Tp>::type;
1210 template<
typename _Tp>
1212 :
public __is_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1214 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1215 "template argument must be a complete class or an unbounded array");
1219 template<
typename _Tp,
typename... _Args>
1220 using __is_nothrow_constructible_impl
1221 = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;
1225 template<
typename _Tp,
typename... _Args>
1227 :
public __is_nothrow_constructible_impl<_Tp, _Args...>
1229 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1230 "template argument must be a complete class or an unbounded array");
1234 template<
typename _Tp>
1236 :
public __is_nothrow_constructible_impl<_Tp>
1238 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1239 "template argument must be a complete class or an unbounded array");
1243 template<
typename _Tp>
1245 :
public __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1247 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1248 "template argument must be a complete class or an unbounded array");
1252 template<
typename _Tp>
1254 :
public __is_nothrow_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1256 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1257 "template argument must be a complete class or an unbounded array");
1261 template<
typename _Tp,
typename _Up>
1262 using __is_assignable_impl = __bool_constant<__is_assignable(_Tp, _Up)>;
1266 template<
typename _Tp,
typename _Up>
1268 :
public __is_assignable_impl<_Tp, _Up>
1270 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1271 "template argument must be a complete class or an unbounded array");
1275 template<
typename _Tp>
1277 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>,
1278 __add_lval_ref_t<const _Tp>>
1280 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1281 "template argument must be a complete class or an unbounded array");
1285 template<
typename _Tp>
1287 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>>
1289 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1290 "template argument must be a complete class or an unbounded array");
1294 template<
typename _Tp,
typename _Up>
1295 using __is_nothrow_assignable_impl
1296 = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>;
1300 template<
typename _Tp,
typename _Up>
1302 :
public __is_nothrow_assignable_impl<_Tp, _Up>
1304 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1305 "template argument must be a complete class or an unbounded array");
1309 template<
typename _Tp>
1311 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1312 __add_lval_ref_t<const _Tp>>
1314 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1315 "template argument must be a complete class or an unbounded array");
1319 template<
typename _Tp>
1321 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1322 __add_rval_ref_t<_Tp>>
1324 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1325 "template argument must be a complete class or an unbounded array");
1329 template<
typename _Tp,
typename... _Args>
1330 using __is_trivially_constructible_impl
1331 = __bool_constant<__is_trivially_constructible(_Tp, _Args...)>;
1335 template<
typename _Tp,
typename... _Args>
1337 :
public __is_trivially_constructible_impl<_Tp, _Args...>
1339 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1340 "template argument must be a complete class or an unbounded array");
1344 template<
typename _Tp>
1346 :
public __is_trivially_constructible_impl<_Tp>
1348 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1349 "template argument must be a complete class or an unbounded array");
1352#if __cpp_variable_templates && __cpp_concepts
1353 template<
typename _Tp>
1354 constexpr bool __is_implicitly_default_constructible_v
1355 =
requires (void(&__f)(_Tp)) { __f({}); };
1357 template<
typename _Tp>
1358 struct __is_implicitly_default_constructible
1359 : __bool_constant<__is_implicitly_default_constructible_v<_Tp>>
1362 struct __do_is_implicitly_default_constructible_impl
1364 template <
typename _Tp>
1365 static void __helper(
const _Tp&);
1367 template <
typename _Tp>
1369 decltype(__helper<const _Tp&>({}))* = 0);
1374 template<
typename _Tp>
1375 struct __is_implicitly_default_constructible_impl
1376 :
public __do_is_implicitly_default_constructible_impl
1378 using type =
decltype(__test(declval<_Tp>()));
1381 template<
typename _Tp>
1382 struct __is_implicitly_default_constructible_safe
1383 :
public __is_implicitly_default_constructible_impl<_Tp>::type
1386 template <
typename _Tp>
1387 struct __is_implicitly_default_constructible
1388 :
public __and_<__is_constructible_impl<_Tp>,
1389 __is_implicitly_default_constructible_safe<_Tp>>::type
1394 template<
typename _Tp>
1396 :
public __is_trivially_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1398 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1399 "template argument must be a complete class or an unbounded array");
1403 template<
typename _Tp>
1405 :
public __is_trivially_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1407 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1408 "template argument must be a complete class or an unbounded array");
1412 template<
typename _Tp,
typename _Up>
1413 using __is_trivially_assignable_impl
1414 = __bool_constant<__is_trivially_assignable(_Tp, _Up)>;
1418 template<
typename _Tp,
typename _Up>
1420 :
public __is_trivially_assignable_impl<_Tp, _Up>
1422 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1423 "template argument must be a complete class or an unbounded array");
1427 template<
typename _Tp>
1429 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1430 __add_lval_ref_t<const _Tp>>
1432 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1433 "template argument must be a complete class or an unbounded array");
1437 template<
typename _Tp>
1439 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1440 __add_rval_ref_t<_Tp>>
1442 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1443 "template argument must be a complete class or an unbounded array");
1447 template<
typename _Tp>
1449 :
public __and_<__is_destructible_safe<_Tp>,
1450 __bool_constant<__has_trivial_destructor(_Tp)>>::type
1452 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1453 "template argument must be a complete class or an unbounded array");
1458 template<
typename _Tp>
1460 :
public __bool_constant<__has_virtual_destructor(_Tp)>
1462 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1463 "template argument must be a complete class or an unbounded array");
1470 template<
typename _Tp>
1474 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1475 "template argument must be a complete class or an unbounded array");
1479#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank)
1480 template<
typename _Tp>
1488 template<
typename _Tp, std::
size_t _Size>
1489 struct rank<_Tp[_Size]>
1492 template<
typename _Tp>
1494 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1498 template<
typename,
unsigned _U
int = 0>
1502 template<
typename _Tp,
size_t _Size>
1503 struct extent<_Tp[_Size], 0>
1506 template<
typename _Tp,
unsigned _U
int,
size_t _Size>
1507 struct extent<_Tp[_Size], _Uint>
1508 :
public extent<_Tp, _Uint - 1>::type { };
1510 template<
typename _Tp>
1511 struct extent<_Tp[], 0>
1512 :
public integral_constant<size_t, 0> { };
1514 template<
typename _Tp,
unsigned _U
int>
1515 struct extent<_Tp[], _Uint>
1516 :
public extent<_Tp, _Uint - 1>::type { };
1522#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
1523 template<
typename _Tp,
typename _Up>
1525 :
public __bool_constant<__is_same(_Tp, _Up)>
1528 template<
typename _Tp,
typename _Up>
1533 template<
typename _Tp>
1540 template<
typename _Base,
typename _Derived>
1542 :
public __bool_constant<__is_base_of(_Base, _Derived)>
1545#ifdef __cpp_lib_is_virtual_base_of
1548 template<typename _Base, typename _Derived>
1549 struct is_virtual_base_of
1550 :
public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)>
1554#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
1555 template<
typename _From,
typename _To>
1556 struct is_convertible
1557 :
public __bool_constant<__is_convertible(_From, _To)>
1560 template<
typename _From,
typename _To,
1561 bool = __or_<is_void<_From>, is_function<_To>,
1562 is_array<_To>>::value>
1563 struct __is_convertible_helper
1565 using type =
typename is_void<_To>::type;
1568#pragma GCC diagnostic push
1569#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1570 template<
typename _From,
typename _To>
1571 class __is_convertible_helper<_From, _To, false>
1573 template<
typename _To1>
1574 static void __test_aux(_To1)
noexcept;
1576 template<
typename _From1,
typename _To1,
1577 typename =
decltype(__test_aux<_To1>(std::declval<_From1>()))>
1581 template<
typename,
typename>
1586 using type =
decltype(__test<_From, _To>(0));
1588#pragma GCC diagnostic pop
1591 template<
typename _From,
typename _To>
1593 :
public __is_convertible_helper<_From, _To>::type
1598 template<
typename _ToElementType,
typename _FromElementType>
1599 using __is_array_convertible
1602#ifdef __cpp_lib_is_nothrow_convertible
1604#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
1606 template<
typename _From,
typename _To>
1607 inline constexpr bool is_nothrow_convertible_v
1608 = __is_nothrow_convertible(_From, _To);
1611 template<
typename _From,
typename _To>
1612 struct is_nothrow_convertible
1613 :
public bool_constant<is_nothrow_convertible_v<_From, _To>>
1616 template<
typename _From,
typename _To,
1617 bool = __or_<is_void<_From>, is_function<_To>,
1618 is_array<_To>>::value>
1619 struct __is_nt_convertible_helper
1623#pragma GCC diagnostic push
1624#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1625 template<
typename _From,
typename _To>
1626 class __is_nt_convertible_helper<_From, _To, false>
1628 template<
typename _To1>
1629 static void __test_aux(_To1)
noexcept;
1631 template<
typename _From1,
typename _To1>
1633 __bool_constant<noexcept(__test_aux<_To1>(std::declval<_From1>()))>
1636 template<
typename,
typename>
1641 using type =
decltype(__test<_From, _To>(0));
1643#pragma GCC diagnostic pop
1646 template<
typename _From,
typename _To>
1647 struct is_nothrow_convertible
1648 :
public __is_nt_convertible_helper<_From, _To>::type
1652 template<
typename _From,
typename _To>
1653 inline constexpr bool is_nothrow_convertible_v
1654 = is_nothrow_convertible<_From, _To>::value;
1658#pragma GCC diagnostic push
1659#pragma GCC diagnostic ignored "-Wc++14-extensions"
1660 template<
typename _Tp,
typename... _Args>
1661 struct __is_nothrow_new_constructible_impl
1663 noexcept(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))
1667 template<
typename _Tp,
typename... _Args>
1668 _GLIBCXX17_INLINE
constexpr bool __is_nothrow_new_constructible
1669 = __and_<is_constructible<_Tp, _Args...>,
1670 __is_nothrow_new_constructible_impl<_Tp, _Args...>>::value;
1671#pragma GCC diagnostic pop
1676 template<
typename _Tp>
1678 {
using type = _Tp; };
1680 template<
typename _Tp>
1682 {
using type = _Tp; };
1685 template<
typename _Tp>
1687 {
using type = _Tp; };
1689 template<
typename _Tp>
1691 {
using type = _Tp; };
1694#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
1695 template<
typename _Tp>
1697 {
using type = __remove_cv(_Tp); };
1699 template<
typename _Tp>
1701 {
using type = _Tp; };
1703 template<
typename _Tp>
1705 {
using type = _Tp; };
1707 template<
typename _Tp>
1708 struct remove_cv<volatile _Tp>
1709 {
using type = _Tp; };
1711 template<
typename _Tp>
1712 struct remove_cv<const volatile _Tp>
1713 {
using type = _Tp; };
1717 template<
typename _Tp>
1719 {
using type = _Tp
const; };
1722 template<
typename _Tp>
1724 {
using type = _Tp
volatile; };
1727 template<
typename _Tp>
1729 {
using type = _Tp
const volatile; };
1731#ifdef __cpp_lib_transformation_trait_aliases
1733 template<typename _Tp>
1734 using remove_const_t =
typename remove_const<_Tp>::type;
1737 template<
typename _Tp>
1738 using remove_volatile_t =
typename remove_volatile<_Tp>::type;
1741 template<
typename _Tp>
1742 using remove_cv_t =
typename remove_cv<_Tp>::type;
1745 template<
typename _Tp>
1746 using add_const_t =
typename add_const<_Tp>::type;
1749 template<
typename _Tp>
1750 using add_volatile_t =
typename add_volatile<_Tp>::type;
1753 template<
typename _Tp>
1754 using add_cv_t =
typename add_cv<_Tp>::type;
1760#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
1761 template<
typename _Tp>
1763 {
using type = __remove_reference(_Tp); };
1765 template<
typename _Tp>
1767 {
using type = _Tp; };
1769 template<
typename _Tp>
1771 {
using type = _Tp; };
1773 template<
typename _Tp>
1774 struct remove_reference<_Tp&&>
1775 {
using type = _Tp; };
1779 template<
typename _Tp>
1781 {
using type = __add_lval_ref_t<_Tp>; };
1784 template<
typename _Tp>
1786 {
using type = __add_rval_ref_t<_Tp>; };
1788#if __cplusplus > 201103L
1790 template<
typename _Tp>
1794 template<
typename _Tp>
1798 template<
typename _Tp>
1807 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1808 struct __cv_selector;
1810 template<
typename _Unqualified>
1811 struct __cv_selector<_Unqualified, false, false>
1812 {
using __type = _Unqualified; };
1814 template<
typename _Unqualified>
1815 struct __cv_selector<_Unqualified, false, true>
1816 {
using __type =
volatile _Unqualified; };
1818 template<
typename _Unqualified>
1819 struct __cv_selector<_Unqualified, true, false>
1820 {
using __type =
const _Unqualified; };
1822 template<
typename _Unqualified>
1823 struct __cv_selector<_Unqualified, true, true>
1824 {
using __type =
const volatile _Unqualified; };
1826 template<
typename _Qualified,
typename _Unqualified,
1827 bool _IsConst = is_const<_Qualified>::value,
1828 bool _IsVol = is_volatile<_Qualified>::value>
1829 class __match_cv_qualifiers
1831 using __match = __cv_selector<_Unqualified, _IsConst, _IsVol>;
1834 using __type =
typename __match::__type;
1838 template<
typename _Tp>
1839 struct __make_unsigned
1840 {
using __type = _Tp; };
1843 struct __make_unsigned<char>
1844 {
using __type =
unsigned char; };
1847 struct __make_unsigned<signed char>
1848 {
using __type =
unsigned char; };
1851 struct __make_unsigned<short>
1852 {
using __type =
unsigned short; };
1855 struct __make_unsigned<int>
1856 {
using __type =
unsigned int; };
1859 struct __make_unsigned<long>
1860 {
using __type =
unsigned long; };
1863 struct __make_unsigned<long long>
1864 {
using __type =
unsigned long long; };
1866#if defined(__GLIBCXX_TYPE_INT_N_0)
1869 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1870 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_0; };
1872#if defined(__GLIBCXX_TYPE_INT_N_1)
1875 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
1876 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_1; };
1878#if defined(__GLIBCXX_TYPE_INT_N_2)
1881 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
1882 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_2; };
1884#if defined(__GLIBCXX_TYPE_INT_N_3)
1887 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
1888 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_3; };
1892 template<
typename _Tp,
1893 bool _IsInt = is_integral<_Tp>::value,
1894 bool _IsEnum = __is_enum(_Tp)>
1895 class __make_unsigned_selector;
1897 template<
typename _Tp>
1898 class __make_unsigned_selector<_Tp, true, false>
1900 using __unsigned_type
1901 =
typename __make_unsigned<__remove_cv_t<_Tp>>::__type;
1905 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1908 class __make_unsigned_selector_base
1911 template<
typename...>
struct _List { };
1913 template<
typename _Tp,
typename... _Up>
1914 struct _List<_Tp, _Up...> : _List<_Up...>
1915 {
static constexpr size_t __size =
sizeof(_Tp); };
1917 template<
size_t _Sz,
typename _Tp,
bool = (_Sz <= _Tp::__size)>
1920 template<
size_t _Sz,
typename _U
int,
typename... _UInts>
1921 struct __select<_Sz, _List<_Uint, _UInts...>,
true>
1922 {
using __type = _Uint; };
1924 template<
size_t _Sz,
typename _Uint,
typename... _UInts>
1925 struct __select<_Sz, _List<_Uint, _UInts...>, false>
1926 : __select<_Sz, _List<_UInts...>>
1931 template<
typename _Tp>
1932 class __make_unsigned_selector<_Tp, false, true>
1933 : __make_unsigned_selector_base
1936 using _UInts = _List<
unsigned char,
unsigned short,
unsigned int,
1937 unsigned long,
unsigned long long>;
1939 using __unsigned_type =
typename __select<
sizeof(_Tp), _UInts>::__type;
1943 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1951 struct __make_unsigned<wchar_t>
1954 =
typename __make_unsigned_selector<wchar_t, false, true>::__type;
1957#ifdef _GLIBCXX_USE_CHAR8_T
1959 struct __make_unsigned<char8_t>
1962 =
typename __make_unsigned_selector<char8_t, false, true>::__type;
1967 struct __make_unsigned<char16_t>
1970 =
typename __make_unsigned_selector<char16_t, false, true>::__type;
1974 struct __make_unsigned<char32_t>
1977 =
typename __make_unsigned_selector<char32_t, false, true>::__type;
1985 template<
typename _Tp>
1987 {
using type =
typename __make_unsigned_selector<_Tp>::__type; };
1998 template<
typename _Tp>
1999 struct __make_signed
2000 {
using __type = _Tp; };
2003 struct __make_signed<char>
2004 {
using __type =
signed char; };
2007 struct __make_signed<unsigned char>
2008 {
using __type =
signed char; };
2011 struct __make_signed<unsigned short>
2012 {
using __type =
signed short; };
2015 struct __make_signed<unsigned int>
2016 {
using __type =
signed int; };
2019 struct __make_signed<unsigned long>
2020 {
using __type =
signed long; };
2023 struct __make_signed<unsigned long long>
2024 {
using __type =
signed long long; };
2026#if defined(__GLIBCXX_TYPE_INT_N_0)
2029 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
2030 {
using __type = __GLIBCXX_TYPE_INT_N_0; };
2032#if defined(__GLIBCXX_TYPE_INT_N_1)
2035 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
2036 {
using __type = __GLIBCXX_TYPE_INT_N_1; };
2038#if defined(__GLIBCXX_TYPE_INT_N_2)
2041 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
2042 {
using __type = __GLIBCXX_TYPE_INT_N_2; };
2044#if defined(__GLIBCXX_TYPE_INT_N_3)
2047 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
2048 {
using __type = __GLIBCXX_TYPE_INT_N_3; };
2052 template<
typename _Tp,
2053 bool _IsInt = is_integral<_Tp>::value,
2054 bool _IsEnum = __is_enum(_Tp)>
2055 class __make_signed_selector;
2057 template<
typename _Tp>
2058 class __make_signed_selector<_Tp, true, false>
2061 =
typename __make_signed<__remove_cv_t<_Tp>>::__type;
2065 =
typename __match_cv_qualifiers<_Tp, __signed_type>::__type;
2069 template<
typename _Tp>
2070 class __make_signed_selector<_Tp, false, true>
2072 using __unsigned_type =
typename __make_unsigned_selector<_Tp>::__type;
2075 using __type =
typename __make_signed_selector<__unsigned_type>::__type;
2083 struct __make_signed<wchar_t>
2086 =
typename __make_signed_selector<wchar_t, false, true>::__type;
2089#if defined(_GLIBCXX_USE_CHAR8_T)
2091 struct __make_signed<char8_t>
2094 =
typename __make_signed_selector<char8_t, false, true>::__type;
2099 struct __make_signed<char16_t>
2102 =
typename __make_signed_selector<char16_t, false, true>::__type;
2106 struct __make_signed<char32_t>
2109 =
typename __make_signed_selector<char32_t, false, true>::__type;
2117 template<
typename _Tp>
2119 {
using type =
typename __make_signed_selector<_Tp>::__type; };
2125 template<>
struct make_signed<bool const volatile>;
2127#if __cplusplus > 201103L
2129 template<
typename _Tp>
2133 template<
typename _Tp>
2140#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_extent)
2141 template<
typename _Tp>
2143 {
using type = __remove_extent(_Tp); };
2145 template<
typename _Tp>
2147 {
using type = _Tp; };
2149 template<
typename _Tp, std::
size_t _Size>
2151 {
using type = _Tp; };
2153 template<
typename _Tp>
2154 struct remove_extent<_Tp[]>
2155 {
using type = _Tp; };
2159#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
2160 template<
typename _Tp>
2161 struct remove_all_extents
2162 {
using type = __remove_all_extents(_Tp); };
2164 template<
typename _Tp>
2166 {
using type = _Tp; };
2168 template<
typename _Tp, std::
size_t _Size>
2170 {
using type =
typename remove_all_extents<_Tp>::type; };
2172 template<
typename _Tp>
2173 struct remove_all_extents<_Tp[]>
2174 {
using type =
typename remove_all_extents<_Tp>::type; };
2177#if __cplusplus > 201103L
2179 template<
typename _Tp>
2183 template<
typename _Tp>
2190#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_pointer)
2191 template<
typename _Tp>
2192 struct remove_pointer
2193 {
using type = __remove_pointer(_Tp); };
2195 template<
typename _Tp,
typename>
2197 {
using type = _Tp; };
2199 template<
typename _Tp,
typename _Up>
2201 {
using type = _Up; };
2203 template<
typename _Tp>
2204 struct remove_pointer
2205 :
public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>>
2210#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer)
2211 template<
typename _Tp>
2213 {
using type = __add_pointer(_Tp); };
2215 template<
typename _Tp,
typename =
void>
2217 {
using type = _Tp; };
2219 template<
typename _Tp>
2221 {
using type = _Tp*; };
2223 template<
typename _Tp>
2225 :
public __add_pointer_helper<_Tp>
2228 template<
typename _Tp>
2229 struct add_pointer<_Tp&>
2230 {
using type = _Tp*; };
2232 template<
typename _Tp>
2233 struct add_pointer<_Tp&&>
2234 {
using type = _Tp*; };
2237#if __cplusplus > 201103L
2239 template<
typename _Tp>
2243 template<
typename _Tp>
2250 struct __attribute__((__aligned__)) __aligned_storage_max_align_t
2254 __aligned_storage_default_alignment([[__maybe_unused__]]
size_t __len)
2256#if _GLIBCXX_INLINE_VERSION
2258 = integral_constant<size_t,
alignof(__aligned_storage_max_align_t)>;
2260 return __len > (_Max_align::value / 2)
2262#
if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_clzg)
2263 : 1 << (__SIZE_WIDTH__ - __builtin_clzg(__len - 1u));
2265 : 1 << (__LLONG_WIDTH__ - __builtin_clzll(__len - 1ull));
2270 return alignof(__aligned_storage_max_align_t);
2306 template<
size_t _Len,
2307 size_t _Align = __aligned_storage_default_alignment(_Len)>
2309 _GLIBCXX23_DEPRECATED
2314 alignas(_Align)
unsigned char __data[_Len];
2318 template <
typename... _Types>
2319 struct __strictest_alignment
2321 static const size_t _S_alignment = 0;
2322 static const size_t _S_size = 0;
2325 template <
typename _Tp,
typename... _Types>
2326 struct __strictest_alignment<_Tp, _Types...>
2328 static const size_t _S_alignment =
2329 alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
2330 ?
alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
2331 static const size_t _S_size =
2332 sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
2333 ?
sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
2336#pragma GCC diagnostic push
2337#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2351 template <
size_t _Len,
typename... _Types>
2353 _GLIBCXX23_DEPRECATED
2357 static_assert(
sizeof...(_Types) != 0,
"At least one type is required");
2359 using __strictest = __strictest_alignment<_Types...>;
2360 static const size_t _S_len = _Len > __strictest::_S_size
2361 ? _Len : __strictest::_S_size;
2364 static const size_t alignment_value = __strictest::_S_alignment;
2369 template <
size_t _Len,
typename... _Types>
2370 const size_t aligned_union<_Len, _Types...>::alignment_value;
2371#pragma GCC diagnostic pop
2375#if _GLIBCXX_USE_BUILTIN_TRAIT(__decay)
2376 template<
typename _Tp>
2378 {
using type = __decay(_Tp); };
2382 template<
typename _Up>
2383 struct __decay_selector
2384 : __conditional_t<is_const<const _Up>::value,
2389 template<
typename _Up,
size_t _Nm>
2390 struct __decay_selector<_Up[_Nm]>
2391 {
using type = _Up*; };
2393 template<
typename _Up>
2394 struct __decay_selector<_Up[]>
2395 {
using type = _Up*; };
2400 template<
typename _Tp>
2402 {
using type =
typename __decay_selector<_Tp>::type; };
2404 template<
typename _Tp>
2406 {
using type =
typename __decay_selector<_Tp>::type; };
2408 template<
typename _Tp>
2410 {
using type =
typename __decay_selector<_Tp>::type; };
2416 template<
typename _Tp>
2417 struct __strip_reference_wrapper
2422 template<
typename _Tp>
2423 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
2425 using __type = _Tp&;
2429 template<
typename _Tp>
2430 using __decay_t =
typename decay<_Tp>::type;
2432 template<
typename _Tp>
2433 using __decay_and_strip = __strip_reference_wrapper<__decay_t<_Tp>>;
2439 template<
typename... _Cond>
2440 using _Require = __enable_if_t<__and_<_Cond...>::value>;
2443 template<
typename _Tp>
2444 using __remove_cvref_t
2445 =
typename remove_cv<typename remove_reference<_Tp>::type>::type;
2450 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2452 {
using type = _Iftrue; };
2455 template<
typename _Iftrue,
typename _Iffalse>
2457 {
using type = _Iffalse; };
2460 template<
typename... _Tp>
2472 template<
typename _Tp>
2473 struct __success_type
2474 {
using type = _Tp; };
2476 struct __failure_type
2479 struct __do_common_type_impl
2481 template<
typename _Tp,
typename _Up>
2483 =
decltype(
true ? std::declval<_Tp>() :
std::declval<_Up>());
2487 template<
typename _Tp,
typename _Up>
2488 static __success_type<__decay_t<__cond_t<_Tp, _Up>>>
2491#if __cplusplus > 201703L
2494 template<
typename _Tp,
typename _Up>
2495 static __success_type<__remove_cvref_t<__cond_t<const _Tp&, const _Up&>>>
2499 template<
typename,
typename>
2500 static __failure_type
2503 template<
typename _Tp,
typename _Up>
2504 static decltype(_S_test_2<_Tp, _Up>(0))
2510 struct common_type<>
2514 template<
typename _Tp0>
2515 struct common_type<_Tp0>
2516 :
public common_type<_Tp0, _Tp0>
2520 template<
typename _Tp1,
typename _Tp2,
2521 typename _Dp1 = __decay_t<_Tp1>,
typename _Dp2 = __decay_t<_Tp2>>
2522 struct __common_type_impl
2526 using type = common_type<_Dp1, _Dp2>;
2529 template<
typename _Tp1,
typename _Tp2>
2530 struct __common_type_impl<_Tp1, _Tp2, _Tp1, _Tp2>
2531 :
private __do_common_type_impl
2535 using type =
decltype(_S_test<_Tp1, _Tp2>(0));
2539 template<
typename _Tp1,
typename _Tp2>
2540 struct common_type<_Tp1, _Tp2>
2541 :
public __common_type_impl<_Tp1, _Tp2>::type
2544 template<
typename...>
2545 struct __common_type_pack
2548 template<
typename,
typename,
typename =
void>
2549 struct __common_type_fold;
2552 template<
typename _Tp1,
typename _Tp2,
typename... _Rp>
2553 struct common_type<_Tp1, _Tp2, _Rp...>
2554 :
public __common_type_fold<common_type<_Tp1, _Tp2>,
2555 __common_type_pack<_Rp...>>
2561 template<
typename _CTp,
typename... _Rp>
2562 struct __common_type_fold<_CTp, __common_type_pack<_Rp...>,
2563 __void_t<typename _CTp::type>>
2564 :
public common_type<typename _CTp::type, _Rp...>
2568 template<
typename _CTp,
typename _Rp>
2569 struct __common_type_fold<_CTp, _Rp, void>
2572 template<
typename _Tp,
bool = __is_enum(_Tp)>
2573 struct __underlying_type_impl
2575 using type = __underlying_type(_Tp);
2578 template<
typename _Tp>
2579 struct __underlying_type_impl<_Tp, false>
2584 template<
typename _Tp>
2586 :
public __underlying_type_impl<_Tp>
2590 template<
typename _Tp>
2591 struct __declval_protector
2593 static const bool __stop =
false;
2601 template<
typename _Tp>
2602 auto declval() noexcept -> decltype(__declval<_Tp>(0))
2604 static_assert(__declval_protector<_Tp>::__stop,
2605 "declval() must not be used!");
2606 return __declval<_Tp>(0);
2610 template<
typename _Signature>
2616 struct __invoke_memfun_ref { };
2617 struct __invoke_memfun_deref { };
2618 struct __invoke_memobj_ref { };
2619 struct __invoke_memobj_deref { };
2620 struct __invoke_other { };
2623 template<
typename _Tp,
typename _Tag>
2624 struct __result_of_success : __success_type<_Tp>
2625 {
using __invoke_type = _Tag; };
2628 struct __result_of_memfun_ref_impl
2630 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2631 static __result_of_success<
decltype(
2632 (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
2633 ), __invoke_memfun_ref> _S_test(
int);
2635 template<
typename...>
2636 static __failure_type _S_test(...);
2639 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2640 struct __result_of_memfun_ref
2641 :
private __result_of_memfun_ref_impl
2643 using type =
decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2647 struct __result_of_memfun_deref_impl
2649 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2650 static __result_of_success<
decltype(
2651 ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
2652 ), __invoke_memfun_deref> _S_test(
int);
2654 template<
typename...>
2655 static __failure_type _S_test(...);
2658 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2659 struct __result_of_memfun_deref
2660 :
private __result_of_memfun_deref_impl
2662 using type =
decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2666 struct __result_of_memobj_ref_impl
2668 template<
typename _Fp,
typename _Tp1>
2669 static __result_of_success<
decltype(
2670 std::declval<_Tp1>().*std::declval<_Fp>()
2671 ), __invoke_memobj_ref> _S_test(
int);
2673 template<
typename,
typename>
2674 static __failure_type _S_test(...);
2677 template<
typename _MemPtr,
typename _Arg>
2678 struct __result_of_memobj_ref
2679 :
private __result_of_memobj_ref_impl
2681 using type =
decltype(_S_test<_MemPtr, _Arg>(0));
2685 struct __result_of_memobj_deref_impl
2687 template<
typename _Fp,
typename _Tp1>
2688 static __result_of_success<
decltype(
2689 (*std::declval<_Tp1>()).*std::declval<_Fp>()
2690 ), __invoke_memobj_deref> _S_test(
int);
2692 template<
typename,
typename>
2693 static __failure_type _S_test(...);
2696 template<
typename _MemPtr,
typename _Arg>
2697 struct __result_of_memobj_deref
2698 :
private __result_of_memobj_deref_impl
2700 using type =
decltype(_S_test<_MemPtr, _Arg>(0));
2703 template<
typename _MemPtr,
typename _Arg>
2704 struct __result_of_memobj;
2706 template<
typename _Res,
typename _Class,
typename _Arg>
2707 struct __result_of_memobj<_Res _Class::*, _Arg>
2709 using _Argval = __remove_cvref_t<_Arg>;
2710 using _MemPtr = _Res _Class::*;
2711 using type =
typename __conditional_t<__or_<is_same<_Argval, _Class>,
2712 is_base_of<_Class, _Argval>>::value,
2713 __result_of_memobj_ref<_MemPtr, _Arg>,
2714 __result_of_memobj_deref<_MemPtr, _Arg>
2718 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2719 struct __result_of_memfun;
2721 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2722 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2724 using _Argval =
typename remove_reference<_Arg>::type;
2725 using _MemPtr = _Res _Class::*;
2726 using type =
typename __conditional_t<is_base_of<_Class, _Argval>::value,
2727 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2728 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2737 template<
typename _Tp,
typename _Up = __remove_cvref_t<_Tp>>
2743 template<
typename _Tp,
typename _Up>
2744 struct __inv_unwrap<_Tp, reference_wrapper<_Up>>
2749 template<bool, bool,
typename _Functor,
typename... _ArgTypes>
2750 struct __result_of_impl
2752 using type = __failure_type;
2755 template<
typename _MemPtr,
typename _Arg>
2756 struct __result_of_impl<true, false, _MemPtr, _Arg>
2757 :
public __result_of_memobj<__decay_t<_MemPtr>,
2758 typename __inv_unwrap<_Arg>::type>
2761 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2762 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2763 :
public __result_of_memfun<__decay_t<_MemPtr>,
2764 typename __inv_unwrap<_Arg>::type, _Args...>
2768 struct __result_of_other_impl
2770 template<
typename _Fn,
typename... _Args>
2771 static __result_of_success<
decltype(
2772 std::declval<_Fn>()(std::declval<_Args>()...)
2773 ), __invoke_other> _S_test(
int);
2775 template<
typename...>
2776 static __failure_type _S_test(...);
2779 template<
typename _Functor,
typename... _ArgTypes>
2780 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2781 :
private __result_of_other_impl
2783 using type =
decltype(_S_test<_Functor, _ArgTypes...>(0));
2787 template<
typename _Functor,
typename... _ArgTypes>
2788 struct __invoke_result
2789 :
public __result_of_impl<
2790 is_member_object_pointer<
2791 typename remove_reference<_Functor>::type
2793 is_member_function_pointer<
2794 typename remove_reference<_Functor>::type
2796 _Functor, _ArgTypes...
2801 template<
typename _Fn,
typename... _Args>
2802 using __invoke_result_t =
typename __invoke_result<_Fn, _Args...>::type;
2805 template<
typename _Functor,
typename... _ArgTypes>
2806 struct result_of<_Functor(_ArgTypes...)>
2807 :
public __invoke_result<_Functor, _ArgTypes...>
2808 { } _GLIBCXX17_DEPRECATED_SUGGEST(
"std::invoke_result");
2810#if __cplusplus >= 201402L
2811#pragma GCC diagnostic push
2812#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2814 template<
size_t _Len,
2815 size_t _Align = __aligned_storage_default_alignment(_Len)>
2818 template <
size_t _Len,
typename... _Types>
2819 using aligned_union_t _GLIBCXX23_DEPRECATED =
typename aligned_union<_Len, _Types...>::type;
2820#pragma GCC diagnostic pop
2823 template<
typename _Tp>
2827 template<
bool _Cond,
typename _Tp =
void>
2831 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2835 template<
typename... _Tp>
2839 template<
typename _Tp>
2843 template<
typename _Tp>
2847#ifdef __cpp_lib_void_t
2849 template<typename...> using void_t = void;
2859 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
2860 struct __detected_or
2867 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
2868 requires requires {
typename _Op<_Args...>; }
2869 struct __detected_or<_Def, _Op, _Args...>
2871 using type = _Op<_Args...>;
2876 template<
typename _Default,
typename _AlwaysVoid,
2877 template<
typename...>
class _Op,
typename... _Args>
2880 using type = _Default;
2885 template<
typename _Default,
template<
typename...>
class _Op,
2887 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
2889 using type = _Op<_Args...>;
2893 template<
typename _Default,
template<
typename...>
class _Op,
2895 using __detected_or = __detector<_Default, void, _Op, _Args...>;
2899 template<
typename _Default,
template<
typename...>
class _Op,
2901 using __detected_or_t
2902 =
typename __detected_or<_Default, _Op, _Args...>::type;
2908#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
2909 template<typename _Tp, typename = __void_t<>> \
2910 struct __has_##_NTYPE \
2913 template<typename _Tp> \
2914 struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
2918 template <
typename _Tp>
2919 struct __is_swappable;
2921 template <
typename _Tp>
2922 struct __is_nothrow_swappable;
2929 template<
typename _Tp>
2930 struct __is_tuple_like
2931 :
public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type
2935 template<
typename _Tp>
2936 _GLIBCXX20_CONSTEXPR
2938 _Require<__not_<__is_tuple_like<_Tp>>,
2939 is_move_constructible<_Tp>,
2940 is_move_assignable<_Tp>>
2942 noexcept(__and_<is_nothrow_move_constructible<_Tp>,
2943 is_nothrow_move_assignable<_Tp>>::value);
2945 template<
typename _Tp,
size_t _Nm>
2946 _GLIBCXX20_CONSTEXPR
2948 __enable_if_t<__is_swappable<_Tp>::value>
2949 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
2950 noexcept(__is_nothrow_swappable<_Tp>::value);
2953 namespace __swappable_details {
2956 struct __do_is_swappable_impl
2958 template<
typename _Tp,
typename
2959 =
decltype(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
2960 static true_type __test(
int);
2966 struct __do_is_nothrow_swappable_impl
2968 template<
typename _Tp>
2969 static __bool_constant<
2970 noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
2979 template<
typename _Tp>
2980 struct __is_swappable_impl
2981 :
public __swappable_details::__do_is_swappable_impl
2983 using type =
decltype(__test<_Tp>(0));
2986 template<
typename _Tp>
2987 struct __is_nothrow_swappable_impl
2988 :
public __swappable_details::__do_is_nothrow_swappable_impl
2990 using type =
decltype(__test<_Tp>(0));
2993 template<
typename _Tp>
2994 struct __is_swappable
2995 :
public __is_swappable_impl<_Tp>::type
2998 template<
typename _Tp>
2999 struct __is_nothrow_swappable
3000 :
public __is_nothrow_swappable_impl<_Tp>::type
3004#ifdef __cpp_lib_is_swappable
3008 template<
typename _Tp>
3010 :
public __is_swappable_impl<_Tp>::type
3012 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3013 "template argument must be a complete class or an unbounded array");
3017 template<
typename _Tp>
3018 struct is_nothrow_swappable
3019 :
public __is_nothrow_swappable_impl<_Tp>::type
3021 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3022 "template argument must be a complete class or an unbounded array");
3025#if __cplusplus >= 201402L
3027 template<
typename _Tp>
3028 _GLIBCXX17_INLINE
constexpr bool is_swappable_v =
3029 is_swappable<_Tp>::value;
3032 template<
typename _Tp>
3033 _GLIBCXX17_INLINE
constexpr bool is_nothrow_swappable_v =
3034 is_nothrow_swappable<_Tp>::value;
3038 namespace __swappable_with_details {
3041 struct __do_is_swappable_with_impl
3043 template<
typename _Tp,
typename _Up,
typename
3044 =
decltype(swap(std::declval<_Tp>(), std::declval<_Up>())),
3046 =
decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))>
3049 template<
typename,
typename>
3053 struct __do_is_nothrow_swappable_with_impl
3055 template<
typename _Tp,
typename _Up>
3056 static __bool_constant<
3057 noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))
3059 noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()))
3062 template<
typename,
typename>
3068 template<
typename _Tp,
typename _Up>
3069 struct __is_swappable_with_impl
3070 :
public __swappable_with_details::__do_is_swappable_with_impl
3072 using type =
decltype(__test<_Tp, _Up>(0));
3076 template<
typename _Tp>
3077 struct __is_swappable_with_impl<_Tp&, _Tp&>
3078 :
public __swappable_details::__do_is_swappable_impl
3080 using type =
decltype(__test<_Tp&>(0));
3083 template<
typename _Tp,
typename _Up>
3084 struct __is_nothrow_swappable_with_impl
3085 :
public __swappable_with_details::__do_is_nothrow_swappable_with_impl
3087 using type =
decltype(__test<_Tp, _Up>(0));
3091 template<
typename _Tp>
3092 struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
3093 :
public __swappable_details::__do_is_nothrow_swappable_impl
3095 using type =
decltype(__test<_Tp&>(0));
3100 template<
typename _Tp,
typename _Up>
3101 struct is_swappable_with
3102 :
public __is_swappable_with_impl<_Tp, _Up>::type
3104 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3105 "first template argument must be a complete class or an unbounded array");
3106 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3107 "second template argument must be a complete class or an unbounded array");
3111 template<
typename _Tp,
typename _Up>
3112 struct is_nothrow_swappable_with
3113 :
public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
3115 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3116 "first template argument must be a complete class or an unbounded array");
3117 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3118 "second template argument must be a complete class or an unbounded array");
3121#if __cplusplus >= 201402L
3123 template<
typename _Tp,
typename _Up>
3124 _GLIBCXX17_INLINE
constexpr bool is_swappable_with_v =
3125 is_swappable_with<_Tp, _Up>::value;
3128 template<
typename _Tp,
typename _Up>
3129 _GLIBCXX17_INLINE
constexpr bool is_nothrow_swappable_with_v =
3130 is_nothrow_swappable_with<_Tp, _Up>::value;
3140 template<
typename _Result,
typename _Ret,
3141 bool = is_void<_Ret>::value,
typename =
void>
3142 struct __is_invocable_impl
3149 template<
typename _Result,
typename _Ret>
3150 struct __is_invocable_impl<_Result, _Ret,
3152 __void_t<typename _Result::type>>
3158#pragma GCC diagnostic push
3159#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3161 template<
typename _Result,
typename _Ret>
3162 struct __is_invocable_impl<_Result, _Ret,
3164 __void_t<typename _Result::type>>
3168 using _Res_t =
typename _Result::type;
3172 static _Res_t _S_get() noexcept;
3175 template<typename _Tp>
3176 static
void _S_conv(__type_identity_t<_Tp>) noexcept;
3179 template<typename _Tp,
3180 bool _Nothrow = noexcept(_S_conv<_Tp>(_S_get())),
3181 typename = decltype(_S_conv<_Tp>(_S_get())),
3182#if __has_builtin(__reference_converts_from_temporary)
3183 bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
3185 bool _Dangle =
false
3188 static __bool_constant<_Nothrow && !_Dangle>
3191 template<
typename _Tp,
bool = false>
3197 using type =
decltype(_S_test<_Ret,
true>(1));
3200 using __nothrow_conv =
decltype(_S_test<_Ret>(1));
3202#pragma GCC diagnostic pop
3204 template<
typename _Fn,
typename... _ArgTypes>
3205 struct __is_invocable
3206 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3209 template<
typename _Fn,
typename _Tp,
typename... _Args>
3210 constexpr bool __call_is_nt(__invoke_memfun_ref)
3212 using _Up =
typename __inv_unwrap<_Tp>::type;
3213 return noexcept((std::declval<_Up>().*std::declval<_Fn>())(
3214 std::declval<_Args>()...));
3217 template<
typename _Fn,
typename _Tp,
typename... _Args>
3218 constexpr bool __call_is_nt(__invoke_memfun_deref)
3220 return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())(
3221 std::declval<_Args>()...));
3224 template<
typename _Fn,
typename _Tp>
3225 constexpr bool __call_is_nt(__invoke_memobj_ref)
3227 using _Up =
typename __inv_unwrap<_Tp>::type;
3228 return noexcept(std::declval<_Up>().*std::declval<_Fn>());
3231 template<
typename _Fn,
typename _Tp>
3232 constexpr bool __call_is_nt(__invoke_memobj_deref)
3234 return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>());
3237 template<
typename _Fn,
typename... _Args>
3238 constexpr bool __call_is_nt(__invoke_other)
3240 return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
3243 template<
typename _Result,
typename _Fn,
typename... _Args>
3244 struct __call_is_nothrow
3246 std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
3250 template<
typename _Fn,
typename... _Args>
3251 using __call_is_nothrow_
3252 = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
3255 template<
typename _Fn,
typename... _Args>
3256 struct __is_nothrow_invocable
3257 : __and_<__is_invocable<_Fn, _Args...>,
3258 __call_is_nothrow_<_Fn, _Args...>>::type
3261#pragma GCC diagnostic push
3262#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3263 struct __nonesuchbase {};
3264 struct __nonesuch :
private __nonesuchbase {
3265 ~__nonesuch() =
delete;
3266 __nonesuch(__nonesuch
const&) =
delete;
3267 void operator=(__nonesuch
const&) =
delete;
3269#pragma GCC diagnostic pop
3272#ifdef __cpp_lib_is_invocable
3274 template<typename _Functor, typename... _ArgTypes>
3275 struct invoke_result
3276 :
public __invoke_result<_Functor, _ArgTypes...>
3278 static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
3279 "_Functor must be a complete class or an unbounded array");
3280 static_assert((std::__is_complete_or_unbounded(
3281 __type_identity<_ArgTypes>{}) && ...),
3282 "each argument type must be a complete class or an unbounded array");
3286 template<
typename _Fn,
typename... _Args>
3287 using invoke_result_t =
typename invoke_result<_Fn, _Args...>::type;
3290 template<
typename _Fn,
typename... _ArgTypes>
3292#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3293 :
public __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
3295 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3298 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3299 "_Fn must be a complete class or an unbounded array");
3300 static_assert((std::__is_complete_or_unbounded(
3301 __type_identity<_ArgTypes>{}) && ...),
3302 "each argument type must be a complete class or an unbounded array");
3306 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3307 struct is_invocable_r
3308 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
3310 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3311 "_Fn must be a complete class or an unbounded array");
3312 static_assert((std::__is_complete_or_unbounded(
3313 __type_identity<_ArgTypes>{}) && ...),
3314 "each argument type must be a complete class or an unbounded array");
3315 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3316 "_Ret must be a complete class or an unbounded array");
3320 template<
typename _Fn,
typename... _ArgTypes>
3321 struct is_nothrow_invocable
3322#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3323 :
public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)>
3325 : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
3326 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3329 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3330 "_Fn must be a complete class or an unbounded array");
3331 static_assert((std::__is_complete_or_unbounded(
3332 __type_identity<_ArgTypes>{}) && ...),
3333 "each argument type must be a complete class or an unbounded array");
3340 template<
typename _Result,
typename _Ret>
3341 using __is_nt_invocable_impl
3342 =
typename __is_invocable_impl<_Result, _Ret>::__nothrow_conv;
3346 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3347 struct is_nothrow_invocable_r
3348 : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
3349 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3351 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3352 "_Fn must be a complete class or an unbounded array");
3353 static_assert((std::__is_complete_or_unbounded(
3354 __type_identity<_ArgTypes>{}) && ...),
3355 "each argument type must be a complete class or an unbounded array");
3356 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3357 "_Ret must be a complete class or an unbounded array");
3361#if __cpp_lib_type_trait_variable_templates
3376template <
typename _Tp>
3377 inline constexpr bool is_void_v = is_void<_Tp>::value;
3378template <
typename _Tp>
3379 inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
3380template <
typename _Tp>
3381 inline constexpr bool is_integral_v = is_integral<_Tp>::value;
3382template <
typename _Tp>
3383 inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
3385#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
3386template <
typename _Tp>
3387 inline constexpr bool is_array_v = __is_array(_Tp);
3389template <
typename _Tp>
3390 inline constexpr bool is_array_v =
false;
3391template <
typename _Tp>
3392 inline constexpr bool is_array_v<_Tp[]> =
true;
3393template <
typename _Tp,
size_t _Num>
3394 inline constexpr bool is_array_v<_Tp[_Num]> =
true;
3397#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
3398template <
typename _Tp>
3399 inline constexpr bool is_pointer_v = __is_pointer(_Tp);
3401template <
typename _Tp>
3402 inline constexpr bool is_pointer_v =
false;
3403template <
typename _Tp>
3404 inline constexpr bool is_pointer_v<_Tp*> =
true;
3405template <
typename _Tp>
3406 inline constexpr bool is_pointer_v<_Tp* const> =
true;
3407template <
typename _Tp>
3408 inline constexpr bool is_pointer_v<_Tp* volatile> =
true;
3409template <
typename _Tp>
3410 inline constexpr bool is_pointer_v<_Tp* const volatile> =
true;
3413template <
typename _Tp>
3414 inline constexpr bool is_lvalue_reference_v =
false;
3415template <
typename _Tp>
3416 inline constexpr bool is_lvalue_reference_v<_Tp&> =
true;
3417template <
typename _Tp>
3418 inline constexpr bool is_rvalue_reference_v =
false;
3419template <
typename _Tp>
3420 inline constexpr bool is_rvalue_reference_v<_Tp&&> =
true;
3422#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
3423template <
typename _Tp>
3424 inline constexpr bool is_member_object_pointer_v =
3425 __is_member_object_pointer(_Tp);
3427template <
typename _Tp>
3428 inline constexpr bool is_member_object_pointer_v =
3429 is_member_object_pointer<_Tp>::value;
3432#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
3433template <
typename _Tp>
3434 inline constexpr bool is_member_function_pointer_v =
3435 __is_member_function_pointer(_Tp);
3437template <
typename _Tp>
3438 inline constexpr bool is_member_function_pointer_v =
3439 is_member_function_pointer<_Tp>::value;
3442template <
typename _Tp>
3443 inline constexpr bool is_enum_v = __is_enum(_Tp);
3444template <
typename _Tp>
3445 inline constexpr bool is_union_v = __is_union(_Tp);
3446template <
typename _Tp>
3447 inline constexpr bool is_class_v = __is_class(_Tp);
3450#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
3451template <
typename _Tp>
3452 inline constexpr bool is_reference_v = __is_reference(_Tp);
3454template <
typename _Tp>
3455 inline constexpr bool is_reference_v =
false;
3456template <
typename _Tp>
3457 inline constexpr bool is_reference_v<_Tp&> =
true;
3458template <
typename _Tp>
3459 inline constexpr bool is_reference_v<_Tp&&> =
true;
3462template <
typename _Tp>
3463 inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
3464template <
typename _Tp>
3465 inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
3467#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
3468template <
typename _Tp>
3469 inline constexpr bool is_object_v = __is_object(_Tp);
3471template <
typename _Tp>
3472 inline constexpr bool is_object_v = is_object<_Tp>::value;
3475template <
typename _Tp>
3476 inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
3477template <
typename _Tp>
3478 inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
3480#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
3481template <
typename _Tp>
3482 inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
3484template <
typename _Tp>
3485 inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
3488#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
3489template <
typename _Tp>
3490 inline constexpr bool is_const_v = __is_const(_Tp);
3492template <
typename _Tp>
3493 inline constexpr bool is_const_v =
false;
3494template <
typename _Tp>
3495 inline constexpr bool is_const_v<const _Tp> =
true;
3498#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
3499template <
typename _Tp>
3500 inline constexpr bool is_function_v = __is_function(_Tp);
3502template <
typename _Tp>
3503 inline constexpr bool is_function_v = !is_const_v<const _Tp>;
3504template <
typename _Tp>
3505 inline constexpr bool is_function_v<_Tp&> =
false;
3506template <
typename _Tp>
3507 inline constexpr bool is_function_v<_Tp&&> =
false;
3510#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
3511template <
typename _Tp>
3512 inline constexpr bool is_volatile_v = __is_volatile(_Tp);
3514template <
typename _Tp>
3515 inline constexpr bool is_volatile_v =
false;
3516template <
typename _Tp>
3517 inline constexpr bool is_volatile_v<volatile _Tp> =
true;
3520template <
typename _Tp>
3521 inline constexpr bool is_trivial_v = __is_trivial(_Tp);
3522template <
typename _Tp>
3523 inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
3524template <
typename _Tp>
3525 inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp);
3526template <
typename _Tp>
3527 _GLIBCXX20_DEPRECATED_SUGGEST(
"is_standard_layout_v && is_trivial_v")
3528 inline constexpr
bool is_pod_v = __is_pod(_Tp);
3529template <typename _Tp>
3530 _GLIBCXX17_DEPRECATED
3531 inline constexpr
bool is_literal_type_v = __is_literal_type(_Tp);
3532template <typename _Tp>
3533 inline constexpr
bool is_empty_v = __is_empty(_Tp);
3534template <typename _Tp>
3535 inline constexpr
bool is_polymorphic_v = __is_polymorphic(_Tp);
3536template <typename _Tp>
3537 inline constexpr
bool is_abstract_v = __is_abstract(_Tp);
3538template <typename _Tp>
3539 inline constexpr
bool is_final_v = __is_final(_Tp);
3541template <typename _Tp>
3542 inline constexpr
bool is_signed_v = is_signed<_Tp>::value;
3543template <typename _Tp>
3544 inline constexpr
bool is_unsigned_v = is_unsigned<_Tp>::value;
3546template <typename _Tp, typename... _Args>
3547 inline constexpr
bool is_constructible_v = __is_constructible(_Tp, _Args...);
3548template <typename _Tp>
3549 inline constexpr
bool is_default_constructible_v = __is_constructible(_Tp);
3550template <typename _Tp>
3551 inline constexpr
bool is_copy_constructible_v
3552 = __is_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3553template <typename _Tp>
3554 inline constexpr
bool is_move_constructible_v
3555 = __is_constructible(_Tp, __add_rval_ref_t<_Tp>);
3557template <typename _Tp, typename _Up>
3558 inline constexpr
bool is_assignable_v = __is_assignable(_Tp, _Up);
3559template <typename _Tp>
3560 inline constexpr
bool is_copy_assignable_v
3561 = __is_assignable(__add_lval_ref_t<_Tp>, __add_lval_ref_t<const _Tp>);
3562template <typename _Tp>
3563 inline constexpr
bool is_move_assignable_v
3564 = __is_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3566template <typename _Tp>
3567 inline constexpr
bool is_destructible_v = is_destructible<_Tp>::value;
3569template <typename _Tp, typename... _Args>
3570 inline constexpr
bool is_trivially_constructible_v
3571 = __is_trivially_constructible(_Tp, _Args...);
3572template <typename _Tp>
3573 inline constexpr
bool is_trivially_default_constructible_v
3574 = __is_trivially_constructible(_Tp);
3575template <typename _Tp>
3576 inline constexpr
bool is_trivially_copy_constructible_v
3577 = __is_trivially_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3578template <typename _Tp>
3579 inline constexpr
bool is_trivially_move_constructible_v
3580 = __is_trivially_constructible(_Tp, __add_rval_ref_t<_Tp>);
3582template <typename _Tp, typename _Up>
3583 inline constexpr
bool is_trivially_assignable_v
3584 = __is_trivially_assignable(_Tp, _Up);
3585template <typename _Tp>
3586 inline constexpr
bool is_trivially_copy_assignable_v
3587 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3588 __add_lval_ref_t<const _Tp>);
3589template <typename _Tp>
3590 inline constexpr
bool is_trivially_move_assignable_v
3591 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3592 __add_rval_ref_t<_Tp>);
3595template <
typename _Tp>
3596 inline constexpr bool is_trivially_destructible_v =
false;
3598template <
typename _Tp>
3599 requires (!is_reference_v<_Tp>) &&
requires (_Tp& __t) { __t.~_Tp(); }
3600 inline constexpr bool is_trivially_destructible_v<_Tp>
3601 = __has_trivial_destructor(_Tp);
3602template <
typename _Tp>
3603 inline constexpr bool is_trivially_destructible_v<_Tp&> =
true;
3604template <
typename _Tp>
3605 inline constexpr bool is_trivially_destructible_v<_Tp&&> =
true;
3606template <
typename _Tp,
size_t _Nm>
3607 inline constexpr bool is_trivially_destructible_v<_Tp[_Nm]>
3608 = is_trivially_destructible_v<_Tp>;
3610template <
typename _Tp>
3611 inline constexpr bool is_trivially_destructible_v =
3612 is_trivially_destructible<_Tp>::value;
3615template <
typename _Tp,
typename... _Args>
3616 inline constexpr bool is_nothrow_constructible_v
3617 = __is_nothrow_constructible(_Tp, _Args...);
3618template <
typename _Tp>
3619 inline constexpr bool is_nothrow_default_constructible_v
3620 = __is_nothrow_constructible(_Tp);
3621template <
typename _Tp>
3622 inline constexpr bool is_nothrow_copy_constructible_v
3623 = __is_nothrow_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3624template <
typename _Tp>
3625 inline constexpr bool is_nothrow_move_constructible_v
3626 = __is_nothrow_constructible(_Tp, __add_rval_ref_t<_Tp>);
3628template <
typename _Tp,
typename _Up>
3629 inline constexpr bool is_nothrow_assignable_v
3630 = __is_nothrow_assignable(_Tp, _Up);
3631template <
typename _Tp>
3632 inline constexpr bool is_nothrow_copy_assignable_v
3633 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>,
3634 __add_lval_ref_t<const _Tp>);
3635template <
typename _Tp>
3636 inline constexpr bool is_nothrow_move_assignable_v
3637 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3639template <
typename _Tp>
3640 inline constexpr bool is_nothrow_destructible_v =
3641 is_nothrow_destructible<_Tp>::value;
3643template <
typename _Tp>
3644 inline constexpr bool has_virtual_destructor_v
3645 = __has_virtual_destructor(_Tp);
3647template <
typename _Tp>
3648 inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
3650#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank)
3651template <
typename _Tp>
3652 inline constexpr size_t rank_v = __array_rank(_Tp);
3654template <
typename _Tp>
3655 inline constexpr size_t rank_v = 0;
3656template <
typename _Tp,
size_t _Size>
3657 inline constexpr size_t rank_v<_Tp[_Size]> = 1 + rank_v<_Tp>;
3658template <
typename _Tp>
3659 inline constexpr size_t rank_v<_Tp[]> = 1 + rank_v<_Tp>;
3662template <
typename _Tp,
unsigned _Idx = 0>
3663 inline constexpr size_t extent_v = 0;
3664template <
typename _Tp,
size_t _Size>
3665 inline constexpr size_t extent_v<_Tp[_Size], 0> = _Size;
3666template <
typename _Tp,
unsigned _Idx,
size_t _Size>
3667 inline constexpr size_t extent_v<_Tp[_Size], _Idx> = extent_v<_Tp, _Idx - 1>;
3668template <
typename _Tp>
3669 inline constexpr size_t extent_v<_Tp[], 0> = 0;
3670template <
typename _Tp,
unsigned _Idx>
3671 inline constexpr size_t extent_v<_Tp[], _Idx> = extent_v<_Tp, _Idx - 1>;
3673#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
3674template <
typename _Tp,
typename _Up>
3675 inline constexpr bool is_same_v = __is_same(_Tp, _Up);
3677template <
typename _Tp,
typename _Up>
3678 inline constexpr bool is_same_v =
false;
3679template <
typename _Tp>
3680 inline constexpr bool is_same_v<_Tp, _Tp> =
true;
3682template <
typename _Base,
typename _Derived>
3683 inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
3684#ifdef __cpp_lib_is_virtual_base_of
3685template <
typename _Base,
typename _Derived>
3686 inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived);
3688#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
3689template <
typename _From,
typename _To>
3690 inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
3692template <
typename _From,
typename _To>
3693 inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
3695template<
typename _Fn,
typename... _Args>
3696 inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
3697template<
typename _Fn,
typename... _Args>
3698 inline constexpr bool is_nothrow_invocable_v
3699 = is_nothrow_invocable<_Fn, _Args...>::value;
3700template<
typename _Ret,
typename _Fn,
typename... _Args>
3701 inline constexpr bool is_invocable_r_v
3702 = is_invocable_r<_Ret, _Fn, _Args...>::value;
3703template<
typename _Ret,
typename _Fn,
typename... _Args>
3704 inline constexpr bool is_nothrow_invocable_r_v
3705 = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
3709#ifdef __cpp_lib_has_unique_object_representations
3712 template<typename _Tp>
3713 struct has_unique_object_representations
3714 : bool_constant<__has_unique_object_representations(
3715 remove_cv_t<remove_all_extents_t<_Tp>>
3718 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3719 "template argument must be a complete class or an unbounded array");
3722# if __cpp_lib_type_trait_variable_templates
3724 template<typename _Tp>
3725 inline constexpr bool has_unique_object_representations_v
3726 = has_unique_object_representations<_Tp>::value;
3730#ifdef __cpp_lib_is_aggregate
3733 template<typename _Tp>
3735 : bool_constant<__is_aggregate(remove_cv_t<_Tp>)>
3738# if __cpp_lib_type_trait_variable_templates
3743 template<
typename _Tp>
3744 inline constexpr bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>);
3752#ifdef __cpp_lib_remove_cvref
3753# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
3754 template<
typename _Tp>
3756 {
using type = __remove_cvref(_Tp); };
3758 template<
typename _Tp>
3760 {
using type =
typename remove_cv<_Tp>::type; };
3762 template<
typename _Tp>
3763 struct remove_cvref<_Tp&>
3764 {
using type =
typename remove_cv<_Tp>::type; };
3766 template<
typename _Tp>
3767 struct remove_cvref<_Tp&&>
3768 {
using type =
typename remove_cv<_Tp>::type; };
3771 template<
typename _Tp>
3772 using remove_cvref_t =
typename remove_cvref<_Tp>::type;
3776#ifdef __cpp_lib_type_identity
3781 template<
typename _Tp>
3782 struct type_identity {
using type = _Tp; };
3784 template<
typename _Tp>
3785 using type_identity_t =
typename type_identity<_Tp>::type;
3789#ifdef __cpp_lib_unwrap_ref
3794 template<
typename _Tp>
3795 struct unwrap_reference {
using type = _Tp; };
3797 template<
typename _Tp>
3798 struct unwrap_reference<reference_wrapper<_Tp>> {
using type = _Tp&; };
3800 template<
typename _Tp>
3801 using unwrap_reference_t =
typename unwrap_reference<_Tp>::type;
3808 template<
typename _Tp>
3809 struct unwrap_ref_decay {
using type = unwrap_reference_t<decay_t<_Tp>>; };
3811 template<
typename _Tp>
3812 using unwrap_ref_decay_t =
typename unwrap_ref_decay<_Tp>::type;
3816#ifdef __cpp_lib_bounded_array_traits
3820# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_bounded_array)
3821 template<
typename _Tp>
3822 inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
3824 template<
typename _Tp>
3825 inline constexpr bool is_bounded_array_v =
false;
3827 template<
typename _Tp,
size_t _Size>
3828 inline constexpr bool is_bounded_array_v<_Tp[_Size]> =
true;
3834# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unbounded_array)
3835 template<
typename _Tp>
3836 inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp);
3838 template<
typename _Tp>
3839 inline constexpr bool is_unbounded_array_v =
false;
3841 template<
typename _Tp>
3842 inline constexpr bool is_unbounded_array_v<_Tp[]> =
true;
3847 template<
typename _Tp>
3848 struct is_bounded_array
3849 :
public bool_constant<is_bounded_array_v<_Tp>>
3854 template<
typename _Tp>
3855 struct is_unbounded_array
3856 :
public bool_constant<is_unbounded_array_v<_Tp>>
3860#if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L
3863 template<
typename _Tp,
typename _Up>
3865 : bool_constant<__is_layout_compatible(_Tp, _Up)>
3870 template<
typename _Tp,
typename _Up>
3872 = __is_layout_compatible(_Tp, _Up);
3874#if __has_builtin(__builtin_is_corresponding_member)
3875# ifndef __cpp_lib_is_layout_compatible
3876# error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set"
3880 template<
typename _S1,
typename _S2,
typename _M1,
typename _M2>
3883 {
return __builtin_is_corresponding_member(__m1, __m2); }
3887#if __has_builtin(__is_pointer_interconvertible_base_of) \
3888 && __cplusplus >= 202002L
3891 template<
typename _Base,
typename _Derived>
3893 : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)>
3898 template<
typename _Base,
typename _Derived>
3900 = __is_pointer_interconvertible_base_of(_Base, _Derived);
3902#if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
3903# ifndef __cpp_lib_is_pointer_interconvertible
3904# error "libstdc++ bug: is_pointer_interconvertible available but FTM is not set"
3910 template<
typename _Tp,
typename _Mem>
3913 {
return __builtin_is_pointer_interconvertible_with_class(__mp); }
3917#ifdef __cpp_lib_is_scoped_enum
3921# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
3922 template<
typename _Tp>
3923 struct is_scoped_enum
3924 : bool_constant<__is_scoped_enum(_Tp)>
3927 template<
typename _Tp>
3928 struct is_scoped_enum
3932 template<
typename _Tp>
3933 requires __is_enum(_Tp)
3934 &&
requires(remove_cv_t<_Tp> __t) { __t = __t; }
3935 struct is_scoped_enum<_Tp>
3936 : bool_constant<!requires(_Tp __t, void(*__f)(int)) { __f(__t); }>
3942# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
3943 template<
typename _Tp>
3944 inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
3946 template<
typename _Tp>
3947 inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
3951#ifdef __cpp_lib_reference_from_temporary
3956 template<typename _Tp, typename _Up>
3957 struct reference_constructs_from_temporary
3958 :
public bool_constant<__reference_constructs_from_temporary(_Tp, _Up)>
3960 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
3961 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3962 "template argument must be a complete class or an unbounded array");
3969 template<
typename _Tp,
typename _Up>
3970 struct reference_converts_from_temporary
3971 :
public bool_constant<__reference_converts_from_temporary(_Tp, _Up)>
3973 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
3974 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3975 "template argument must be a complete class or an unbounded array");
3980 template<
typename _Tp,
typename _Up>
3981 inline constexpr bool reference_constructs_from_temporary_v
3982 = reference_constructs_from_temporary<_Tp, _Up>::value;
3986 template<
typename _Tp,
typename _Up>
3987 inline constexpr bool reference_converts_from_temporary_v
3988 = reference_converts_from_temporary<_Tp, _Up>::value;
3991#ifdef __cpp_lib_is_constant_evaluated
3994 constexpr inline bool
3995 is_constant_evaluated() noexcept
3997#if __cpp_if_consteval >= 202106L
3998 if consteval {
return true; }
else {
return false; }
4000 return __builtin_is_constant_evaluated();
4005#if __cplusplus >= 202002L
4007 template<
typename _From,
typename _To>
4008 using __copy_cv =
typename __match_cv_qualifiers<_From, _To>::__type;
4010 template<
typename _Xp,
typename _Yp>
4012 =
decltype(
false ? declval<_Xp(&)()>()() :
declval<_Yp(&)()>()());
4014 template<
typename _Ap,
typename _Bp,
typename =
void>
4015 struct __common_ref_impl
4019 template<
typename _Ap,
typename _Bp>
4020 using __common_ref =
typename __common_ref_impl<_Ap, _Bp>::type;
4023 template<
typename _Xp,
typename _Yp>
4024 using __condres_cvref
4025 = __cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>;
4028 template<
typename _Xp,
typename _Yp>
4029 struct __common_ref_impl<_Xp&, _Yp&, __void_t<__condres_cvref<_Xp, _Yp>>>
4030 : enable_if<is_reference_v<__condres_cvref<_Xp, _Yp>>,
4031 __condres_cvref<_Xp, _Yp>>
4035 template<
typename _Xp,
typename _Yp>
4036 using __common_ref_C = remove_reference_t<__common_ref<_Xp&, _Yp&>>&&;
4039 template<
typename _Xp,
typename _Yp>
4040 struct __common_ref_impl<_Xp&&, _Yp&&,
4041 _Require<is_convertible<_Xp&&, __common_ref_C<_Xp, _Yp>>,
4042 is_convertible<_Yp&&, __common_ref_C<_Xp, _Yp>>>>
4043 {
using type = __common_ref_C<_Xp, _Yp>; };
4046 template<
typename _Xp,
typename _Yp>
4047 using __common_ref_D = __common_ref<const _Xp&, _Yp&>;
4050 template<
typename _Xp,
typename _Yp>
4051 struct __common_ref_impl<_Xp&&, _Yp&,
4052 _Require<is_convertible<_Xp&&, __common_ref_D<_Xp, _Yp>>>>
4053 {
using type = __common_ref_D<_Xp, _Yp>; };
4056 template<
typename _Xp,
typename _Yp>
4057 struct __common_ref_impl<_Xp&, _Yp&&>
4058 : __common_ref_impl<_Yp&&, _Xp&>
4062 template<
typename _Tp,
typename _Up,
4063 template<
typename>
class _TQual,
template<
typename>
class _UQual>
4064 struct basic_common_reference
4068 template<
typename _Tp>
4070 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>; };
4072 template<
typename _Tp>
4074 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&; };
4076 template<
typename _Tp>
4077 struct __xref<_Tp&&>
4078 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&&; };
4080 template<
typename _Tp1,
typename _Tp2>
4081 using __basic_common_ref
4082 =
typename basic_common_reference<remove_cvref_t<_Tp1>,
4083 remove_cvref_t<_Tp2>,
4084 __xref<_Tp1>::template __type,
4085 __xref<_Tp2>::template __type>::type;
4088 template<
typename... _Tp>
4089 struct common_reference;
4091 template<
typename... _Tp>
4096 struct common_reference<>
4100 template<
typename _Tp0>
4101 struct common_reference<_Tp0>
4102 {
using type = _Tp0; };
4105 template<
typename _Tp1,
typename _Tp2,
int _Bullet = 1,
typename =
void>
4106 struct __common_reference_impl
4107 : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1>
4111 template<
typename _Tp1,
typename _Tp2>
4112 struct common_reference<_Tp1, _Tp2>
4113 : __common_reference_impl<_Tp1, _Tp2>
4117 template<
typename _Tp1,
typename _Tp2>
4118 struct __common_reference_impl<_Tp1&, _Tp2&, 1,
4119 void_t<__common_ref<_Tp1&, _Tp2&>>>
4120 {
using type = __common_ref<_Tp1&, _Tp2&>; };
4122 template<
typename _Tp1,
typename _Tp2>
4123 struct __common_reference_impl<_Tp1&&, _Tp2&&, 1,
4124 void_t<__common_ref<_Tp1&&, _Tp2&&>>>
4125 {
using type = __common_ref<_Tp1&&, _Tp2&&>; };
4127 template<
typename _Tp1,
typename _Tp2>
4128 struct __common_reference_impl<_Tp1&, _Tp2&&, 1,
4129 void_t<__common_ref<_Tp1&, _Tp2&&>>>
4130 {
using type = __common_ref<_Tp1&, _Tp2&&>; };
4132 template<
typename _Tp1,
typename _Tp2>
4133 struct __common_reference_impl<_Tp1&&, _Tp2&, 1,
4134 void_t<__common_ref<_Tp1&&, _Tp2&>>>
4135 {
using type = __common_ref<_Tp1&&, _Tp2&>; };
4138 template<
typename _Tp1,
typename _Tp2>
4139 struct __common_reference_impl<_Tp1, _Tp2, 2,
4140 void_t<__basic_common_ref<_Tp1, _Tp2>>>
4141 {
using type = __basic_common_ref<_Tp1, _Tp2>; };
4144 template<
typename _Tp1,
typename _Tp2>
4145 struct __common_reference_impl<_Tp1, _Tp2, 3,
4146 void_t<__cond_res<_Tp1, _Tp2>>>
4147 {
using type = __cond_res<_Tp1, _Tp2>; };
4150 template<
typename _Tp1,
typename _Tp2>
4151 struct __common_reference_impl<_Tp1, _Tp2, 4,
4153 {
using type = common_type_t<_Tp1, _Tp2>; };
4156 template<
typename _Tp1,
typename _Tp2>
4157 struct __common_reference_impl<_Tp1, _Tp2, 5, void>
4161 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4162 struct common_reference<_Tp1, _Tp2, _Rest...>
4163 : __common_type_fold<common_reference<_Tp1, _Tp2>,
4164 __common_type_pack<_Rest...>>
4168 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4169 struct __common_type_fold<common_reference<_Tp1, _Tp2>,
4170 __common_type_pack<_Rest...>,
4172 :
public common_reference<common_reference_t<_Tp1, _Tp2>, _Rest...>
4180_GLIBCXX_END_NAMESPACE_VERSION
typename common_reference< _Tp... >::type common_reference_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.
typename add_rvalue_reference< _Tp >::type add_rvalue_reference_t
Alias template for add_rvalue_reference.
typename make_unsigned< _Tp >::type make_unsigned_t
Alias template for make_unsigned.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
typename aligned_storage< _Len, _Align >::type aligned_storage_t
Alias template for aligned_storage.
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 aligned_storage< _S_len, alignment_value >::type type
The storage.
typename remove_pointer< _Tp >::type remove_pointer_t
Alias template for remove_pointer.
typename add_lvalue_reference< _Tp >::type add_lvalue_reference_t
Alias template for add_lvalue_reference.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
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.
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.
constexpr bool is_layout_compatible_v
constexpr bool is_pointer_interconvertible_base_of_v
auto declval() noexcept -> decltype(__declval< _Tp >(0))
void void_t
A metafunction that always yields void, used for detecting valid types.
ISO C++ entities toplevel namespace is std.
GNU extensions for public use.
Define a member typedef type only if a boolean constant is true.
is_member_function_pointer
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.
Define a member typedef type to one of two argument types.
The underlying type of an enum.
True if _Derived is standard-layout and has a base class of type _Base