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>
895 template<
typename _Tp>
897 _GLIBCXX26_DEPRECATED_SUGGEST(
"is_trivially_default_constructible && is_trivially_copyable")
899 : public __bool_constant<__is_trivial(_Tp)>
901 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
902 "template argument must be a complete class or an unbounded array");
906 template<
typename _Tp>
908 :
public __bool_constant<__is_trivially_copyable(_Tp)>
910 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
911 "template argument must be a complete class or an unbounded array");
915 template<
typename _Tp>
917 :
public __bool_constant<__is_standard_layout(_Tp)>
919 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
920 "template argument must be a complete class or an unbounded array");
928 template<
typename _Tp>
930 _GLIBCXX20_DEPRECATED_SUGGEST(
"is_standard_layout && is_trivial")
932 : public __bool_constant<__is_pod(_Tp)>
934 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
935 "template argument must be a complete class or an unbounded array");
942 template<
typename _Tp>
944 _GLIBCXX17_DEPRECATED
946 :
public __bool_constant<__is_literal_type(_Tp)>
948 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
949 "template argument must be a complete class or an unbounded array");
953 template<
typename _Tp>
955 :
public __bool_constant<__is_empty(_Tp)>
959 template<
typename _Tp>
961 :
public __bool_constant<__is_polymorphic(_Tp)>
964#ifdef __cpp_lib_is_final
967 template<typename _Tp>
969 :
public __bool_constant<__is_final(_Tp)>
974 template<
typename _Tp>
976 :
public __bool_constant<__is_abstract(_Tp)>
980 template<
typename _Tp,
982 struct __is_signed_helper
985 template<
typename _Tp>
986 struct __is_signed_helper<_Tp, true>
987 :
public __bool_constant<_Tp(-1) < _Tp(0)>
992 template<typename _Tp>
994 : public __is_signed_helper<_Tp>::type
998 template<typename _Tp>
1000 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
1004 template<typename _Tp, typename _Up = _Tp&&>
1008 template<typename _Tp>
1013 template<typename _Tp>
1014 auto declval() noexcept -> decltype(__declval<_Tp>(0));
1020 template<typename _Tp>
1021 struct __is_array_known_bounds
1025 template<
typename _Tp,
size_t _Size>
1026 struct __is_array_known_bounds<_Tp[_Size]>
1030 template<
typename _Tp>
1031 struct __is_array_unknown_bounds
1035 template<
typename _Tp>
1036 struct __is_array_unknown_bounds<_Tp[]>
1047 struct __do_is_destructible_impl
1049 template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
1050 static true_type __test(
int);
1056 template<
typename _Tp>
1057 struct __is_destructible_impl
1058 :
public __do_is_destructible_impl
1060 using type =
decltype(__test<_Tp>(0));
1063 template<
typename _Tp,
1064 bool = __or_<is_void<_Tp>,
1065 __is_array_unknown_bounds<_Tp>,
1066 is_function<_Tp>>::value,
1067 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1068 struct __is_destructible_safe;
1070 template<
typename _Tp>
1071 struct __is_destructible_safe<_Tp, false, false>
1072 :
public __is_destructible_impl<typename
1073 remove_all_extents<_Tp>::type>::type
1076 template<
typename _Tp>
1077 struct __is_destructible_safe<_Tp, true, false>
1080 template<
typename _Tp>
1081 struct __is_destructible_safe<_Tp, false, true>
1086 template<
typename _Tp>
1088 :
public __is_destructible_safe<_Tp>::type
1090 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1091 "template argument must be a complete class or an unbounded array");
1100 struct __do_is_nt_destructible_impl
1102 template<
typename _Tp>
1103 static __bool_constant<noexcept(declval<_Tp&>().~_Tp())>
1110 template<
typename _Tp>
1111 struct __is_nt_destructible_impl
1112 :
public __do_is_nt_destructible_impl
1114 using type =
decltype(__test<_Tp>(0));
1117 template<
typename _Tp,
1118 bool = __or_<is_void<_Tp>,
1119 __is_array_unknown_bounds<_Tp>,
1120 is_function<_Tp>>::value,
1121 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1122 struct __is_nt_destructible_safe;
1124 template<
typename _Tp>
1125 struct __is_nt_destructible_safe<_Tp, false, false>
1126 :
public __is_nt_destructible_impl<typename
1127 remove_all_extents<_Tp>::type>::type
1130 template<
typename _Tp>
1131 struct __is_nt_destructible_safe<_Tp, true, false>
1134 template<
typename _Tp>
1135 struct __is_nt_destructible_safe<_Tp, false, true>
1140 template<
typename _Tp>
1142 :
public __is_nt_destructible_safe<_Tp>::type
1144 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1145 "template argument must be a complete class or an unbounded array");
1149 template<
typename _Tp,
typename... _Args>
1150 using __is_constructible_impl
1151 = __bool_constant<__is_constructible(_Tp, _Args...)>;
1155 template<
typename _Tp,
typename... _Args>
1157 :
public __is_constructible_impl<_Tp, _Args...>
1159 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1160 "template argument must be a complete class or an unbounded array");
1164 template<
typename _Tp>
1166 :
public __is_constructible_impl<_Tp>
1168 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1169 "template argument must be a complete class or an unbounded array");
1173#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference)
1174 template<
typename _Tp>
1175 using __add_lval_ref_t = __add_lvalue_reference(_Tp);
1177 template<
typename _Tp,
typename =
void>
1178 struct __add_lvalue_reference_helper
1179 {
using type = _Tp; };
1181 template<
typename _Tp>
1182 struct __add_lvalue_reference_helper<_Tp, __void_t<_Tp&>>
1183 {
using type = _Tp&; };
1185 template<
typename _Tp>
1186 using __add_lval_ref_t =
typename __add_lvalue_reference_helper<_Tp>::type;
1191 template<
typename _Tp>
1193 :
public __is_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1195 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1196 "template argument must be a complete class or an unbounded array");
1200#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_rvalue_reference)
1201 template<
typename _Tp>
1202 using __add_rval_ref_t = __add_rvalue_reference(_Tp);
1204 template<
typename _Tp,
typename =
void>
1205 struct __add_rvalue_reference_helper
1206 {
using type = _Tp; };
1208 template<
typename _Tp>
1209 struct __add_rvalue_reference_helper<_Tp, __void_t<_Tp&&>>
1210 {
using type = _Tp&&; };
1212 template<
typename _Tp>
1213 using __add_rval_ref_t =
typename __add_rvalue_reference_helper<_Tp>::type;
1218 template<
typename _Tp>
1220 :
public __is_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1222 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1223 "template argument must be a complete class or an unbounded array");
1227 template<
typename _Tp,
typename... _Args>
1228 using __is_nothrow_constructible_impl
1229 = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;
1233 template<
typename _Tp,
typename... _Args>
1235 :
public __is_nothrow_constructible_impl<_Tp, _Args...>
1237 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1238 "template argument must be a complete class or an unbounded array");
1242 template<
typename _Tp>
1244 :
public __is_nothrow_constructible_impl<_Tp>
1246 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1247 "template argument must be a complete class or an unbounded array");
1251 template<
typename _Tp>
1253 :
public __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1255 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1256 "template argument must be a complete class or an unbounded array");
1260 template<
typename _Tp>
1262 :
public __is_nothrow_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1264 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1265 "template argument must be a complete class or an unbounded array");
1269 template<
typename _Tp,
typename _Up>
1270 using __is_assignable_impl = __bool_constant<__is_assignable(_Tp, _Up)>;
1274 template<
typename _Tp,
typename _Up>
1276 :
public __is_assignable_impl<_Tp, _Up>
1278 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1279 "template argument must be a complete class or an unbounded array");
1283 template<
typename _Tp>
1285 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>,
1286 __add_lval_ref_t<const _Tp>>
1288 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1289 "template argument must be a complete class or an unbounded array");
1293 template<
typename _Tp>
1295 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>>
1297 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1298 "template argument must be a complete class or an unbounded array");
1302 template<
typename _Tp,
typename _Up>
1303 using __is_nothrow_assignable_impl
1304 = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>;
1308 template<
typename _Tp,
typename _Up>
1310 :
public __is_nothrow_assignable_impl<_Tp, _Up>
1312 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1313 "template argument must be a complete class or an unbounded array");
1317 template<
typename _Tp>
1319 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1320 __add_lval_ref_t<const _Tp>>
1322 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1323 "template argument must be a complete class or an unbounded array");
1327 template<
typename _Tp>
1329 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1330 __add_rval_ref_t<_Tp>>
1332 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1333 "template argument must be a complete class or an unbounded array");
1337 template<
typename _Tp,
typename... _Args>
1338 using __is_trivially_constructible_impl
1339 = __bool_constant<__is_trivially_constructible(_Tp, _Args...)>;
1343 template<
typename _Tp,
typename... _Args>
1345 :
public __is_trivially_constructible_impl<_Tp, _Args...>
1347 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1348 "template argument must be a complete class or an unbounded array");
1352 template<
typename _Tp>
1354 :
public __is_trivially_constructible_impl<_Tp>
1356 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1357 "template argument must be a complete class or an unbounded array");
1360#if __cpp_variable_templates && __cpp_concepts
1361 template<
typename _Tp>
1362 constexpr bool __is_implicitly_default_constructible_v
1363 =
requires (void(&__f)(_Tp)) { __f({}); };
1365 template<
typename _Tp>
1366 struct __is_implicitly_default_constructible
1367 : __bool_constant<__is_implicitly_default_constructible_v<_Tp>>
1370 struct __do_is_implicitly_default_constructible_impl
1372 template <
typename _Tp>
1373 static void __helper(
const _Tp&);
1375 template <
typename _Tp>
1377 decltype(__helper<const _Tp&>({}))* = 0);
1382 template<
typename _Tp>
1383 struct __is_implicitly_default_constructible_impl
1384 :
public __do_is_implicitly_default_constructible_impl
1386 using type =
decltype(__test(declval<_Tp>()));
1389 template<
typename _Tp>
1390 struct __is_implicitly_default_constructible_safe
1391 :
public __is_implicitly_default_constructible_impl<_Tp>::type
1394 template <
typename _Tp>
1395 struct __is_implicitly_default_constructible
1396 :
public __and_<__is_constructible_impl<_Tp>,
1397 __is_implicitly_default_constructible_safe<_Tp>>::type
1402 template<
typename _Tp>
1404 :
public __is_trivially_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1406 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1407 "template argument must be a complete class or an unbounded array");
1411 template<
typename _Tp>
1413 :
public __is_trivially_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1415 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1416 "template argument must be a complete class or an unbounded array");
1420 template<
typename _Tp,
typename _Up>
1421 using __is_trivially_assignable_impl
1422 = __bool_constant<__is_trivially_assignable(_Tp, _Up)>;
1426 template<
typename _Tp,
typename _Up>
1428 :
public __is_trivially_assignable_impl<_Tp, _Up>
1430 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1431 "template argument must be a complete class or an unbounded array");
1435 template<
typename _Tp>
1437 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1438 __add_lval_ref_t<const _Tp>>
1440 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1441 "template argument must be a complete class or an unbounded array");
1445 template<
typename _Tp>
1447 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1448 __add_rval_ref_t<_Tp>>
1450 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1451 "template argument must be a complete class or an unbounded array");
1455 template<
typename _Tp>
1457 :
public __and_<__is_destructible_safe<_Tp>,
1458 __bool_constant<__has_trivial_destructor(_Tp)>>::type
1460 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1461 "template argument must be a complete class or an unbounded array");
1466 template<
typename _Tp>
1468 :
public __bool_constant<__has_virtual_destructor(_Tp)>
1470 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1471 "template argument must be a complete class or an unbounded array");
1478 template<
typename _Tp>
1482 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1483 "template argument must be a complete class or an unbounded array");
1487#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank)
1488 template<
typename _Tp>
1496 template<
typename _Tp, std::
size_t _Size>
1497 struct rank<_Tp[_Size]>
1500 template<
typename _Tp>
1502 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1506 template<
typename,
unsigned _U
int = 0>
1510 template<
typename _Tp,
size_t _Size>
1511 struct extent<_Tp[_Size], 0>
1514 template<
typename _Tp,
unsigned _U
int,
size_t _Size>
1515 struct extent<_Tp[_Size], _Uint>
1516 :
public extent<_Tp, _Uint - 1>::type { };
1518 template<
typename _Tp>
1519 struct extent<_Tp[], 0>
1520 :
public integral_constant<size_t, 0> { };
1522 template<
typename _Tp,
unsigned _U
int>
1523 struct extent<_Tp[], _Uint>
1524 :
public extent<_Tp, _Uint - 1>::type { };
1530#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
1531 template<
typename _Tp,
typename _Up>
1533 :
public __bool_constant<__is_same(_Tp, _Up)>
1536 template<
typename _Tp,
typename _Up>
1541 template<
typename _Tp>
1548 template<
typename _Base,
typename _Derived>
1550 :
public __bool_constant<__is_base_of(_Base, _Derived)>
1553#ifdef __cpp_lib_is_virtual_base_of
1556 template<typename _Base, typename _Derived>
1557 struct is_virtual_base_of
1558 :
public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)>
1562#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
1563 template<
typename _From,
typename _To>
1564 struct is_convertible
1565 :
public __bool_constant<__is_convertible(_From, _To)>
1568 template<
typename _From,
typename _To,
1569 bool = __or_<is_void<_From>, is_function<_To>,
1570 is_array<_To>>::value>
1571 struct __is_convertible_helper
1573 using type =
typename is_void<_To>::type;
1576#pragma GCC diagnostic push
1577#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1578 template<
typename _From,
typename _To>
1579 class __is_convertible_helper<_From, _To, false>
1581 template<
typename _To1>
1582 static void __test_aux(_To1)
noexcept;
1584 template<
typename _From1,
typename _To1,
1585 typename =
decltype(__test_aux<_To1>(std::declval<_From1>()))>
1589 template<
typename,
typename>
1594 using type =
decltype(__test<_From, _To>(0));
1596#pragma GCC diagnostic pop
1599 template<
typename _From,
typename _To>
1601 :
public __is_convertible_helper<_From, _To>::type
1606 template<
typename _ToElementType,
typename _FromElementType>
1607 using __is_array_convertible
1610#ifdef __cpp_lib_is_nothrow_convertible
1612#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
1614 template<
typename _From,
typename _To>
1615 inline constexpr bool is_nothrow_convertible_v
1616 = __is_nothrow_convertible(_From, _To);
1619 template<
typename _From,
typename _To>
1620 struct is_nothrow_convertible
1621 :
public bool_constant<is_nothrow_convertible_v<_From, _To>>
1624 template<
typename _From,
typename _To,
1625 bool = __or_<is_void<_From>, is_function<_To>,
1626 is_array<_To>>::value>
1627 struct __is_nt_convertible_helper
1631#pragma GCC diagnostic push
1632#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1633 template<
typename _From,
typename _To>
1634 class __is_nt_convertible_helper<_From, _To, false>
1636 template<
typename _To1>
1637 static void __test_aux(_To1)
noexcept;
1639 template<
typename _From1,
typename _To1>
1641 __bool_constant<noexcept(__test_aux<_To1>(std::declval<_From1>()))>
1644 template<
typename,
typename>
1649 using type =
decltype(__test<_From, _To>(0));
1651#pragma GCC diagnostic pop
1654 template<
typename _From,
typename _To>
1655 struct is_nothrow_convertible
1656 :
public __is_nt_convertible_helper<_From, _To>::type
1660 template<
typename _From,
typename _To>
1661 inline constexpr bool is_nothrow_convertible_v
1662 = is_nothrow_convertible<_From, _To>::value;
1666#pragma GCC diagnostic push
1667#pragma GCC diagnostic ignored "-Wc++14-extensions"
1668 template<
typename _Tp,
typename... _Args>
1669 struct __is_nothrow_new_constructible_impl
1671 noexcept(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))
1675 template<
typename _Tp,
typename... _Args>
1676 _GLIBCXX17_INLINE
constexpr bool __is_nothrow_new_constructible
1677 = __and_<is_constructible<_Tp, _Args...>,
1678 __is_nothrow_new_constructible_impl<_Tp, _Args...>>::value;
1679#pragma GCC diagnostic pop
1684 template<
typename _Tp>
1686 {
using type = _Tp; };
1688 template<
typename _Tp>
1690 {
using type = _Tp; };
1693 template<
typename _Tp>
1695 {
using type = _Tp; };
1697 template<
typename _Tp>
1699 {
using type = _Tp; };
1702#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
1703 template<
typename _Tp>
1705 {
using type = __remove_cv(_Tp); };
1707 template<
typename _Tp>
1709 {
using type = _Tp; };
1711 template<
typename _Tp>
1713 {
using type = _Tp; };
1715 template<
typename _Tp>
1716 struct remove_cv<volatile _Tp>
1717 {
using type = _Tp; };
1719 template<
typename _Tp>
1720 struct remove_cv<const volatile _Tp>
1721 {
using type = _Tp; };
1725 template<
typename _Tp>
1727 {
using type = _Tp
const; };
1730 template<
typename _Tp>
1732 {
using type = _Tp
volatile; };
1735 template<
typename _Tp>
1737 {
using type = _Tp
const volatile; };
1739#ifdef __cpp_lib_transformation_trait_aliases
1741 template<typename _Tp>
1742 using remove_const_t =
typename remove_const<_Tp>::type;
1745 template<
typename _Tp>
1746 using remove_volatile_t =
typename remove_volatile<_Tp>::type;
1749 template<
typename _Tp>
1750 using remove_cv_t =
typename remove_cv<_Tp>::type;
1753 template<
typename _Tp>
1754 using add_const_t =
typename add_const<_Tp>::type;
1757 template<
typename _Tp>
1758 using add_volatile_t =
typename add_volatile<_Tp>::type;
1761 template<
typename _Tp>
1762 using add_cv_t =
typename add_cv<_Tp>::type;
1768#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
1769 template<
typename _Tp>
1771 {
using type = __remove_reference(_Tp); };
1773 template<
typename _Tp>
1775 {
using type = _Tp; };
1777 template<
typename _Tp>
1779 {
using type = _Tp; };
1781 template<
typename _Tp>
1782 struct remove_reference<_Tp&&>
1783 {
using type = _Tp; };
1787 template<
typename _Tp>
1789 {
using type = __add_lval_ref_t<_Tp>; };
1792 template<
typename _Tp>
1794 {
using type = __add_rval_ref_t<_Tp>; };
1796#if __cplusplus > 201103L
1798 template<
typename _Tp>
1802 template<
typename _Tp>
1806 template<
typename _Tp>
1815 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1816 struct __cv_selector;
1818 template<
typename _Unqualified>
1819 struct __cv_selector<_Unqualified, false, false>
1820 {
using __type = _Unqualified; };
1822 template<
typename _Unqualified>
1823 struct __cv_selector<_Unqualified, false, true>
1824 {
using __type =
volatile _Unqualified; };
1826 template<
typename _Unqualified>
1827 struct __cv_selector<_Unqualified, true, false>
1828 {
using __type =
const _Unqualified; };
1830 template<
typename _Unqualified>
1831 struct __cv_selector<_Unqualified, true, true>
1832 {
using __type =
const volatile _Unqualified; };
1834 template<
typename _Qualified,
typename _Unqualified,
1835 bool _IsConst = is_const<_Qualified>::value,
1836 bool _IsVol = is_volatile<_Qualified>::value>
1837 class __match_cv_qualifiers
1839 using __match = __cv_selector<_Unqualified, _IsConst, _IsVol>;
1842 using __type =
typename __match::__type;
1846 template<
typename _Tp>
1847 struct __make_unsigned
1848 {
using __type = _Tp; };
1851 struct __make_unsigned<char>
1852 {
using __type =
unsigned char; };
1855 struct __make_unsigned<signed char>
1856 {
using __type =
unsigned char; };
1859 struct __make_unsigned<short>
1860 {
using __type =
unsigned short; };
1863 struct __make_unsigned<int>
1864 {
using __type =
unsigned int; };
1867 struct __make_unsigned<long>
1868 {
using __type =
unsigned long; };
1871 struct __make_unsigned<long long>
1872 {
using __type =
unsigned long long; };
1874#if defined(__GLIBCXX_TYPE_INT_N_0)
1877 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1878 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_0; };
1880#if defined(__GLIBCXX_TYPE_INT_N_1)
1883 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
1884 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_1; };
1886#if defined(__GLIBCXX_TYPE_INT_N_2)
1889 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
1890 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_2; };
1892#if defined(__GLIBCXX_TYPE_INT_N_3)
1895 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
1896 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_3; };
1900 template<
typename _Tp,
1901 bool _IsInt = is_integral<_Tp>::value,
1902 bool _IsEnum = __is_enum(_Tp)>
1903 class __make_unsigned_selector;
1905 template<
typename _Tp>
1906 class __make_unsigned_selector<_Tp, true, false>
1908 using __unsigned_type
1909 =
typename __make_unsigned<__remove_cv_t<_Tp>>::__type;
1913 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1916 class __make_unsigned_selector_base
1919 template<
typename...>
struct _List { };
1921 template<
typename _Tp,
typename... _Up>
1922 struct _List<_Tp, _Up...> : _List<_Up...>
1923 {
static constexpr size_t __size =
sizeof(_Tp); };
1925 template<
size_t _Sz,
typename _Tp,
bool = (_Sz <= _Tp::__size)>
1928 template<
size_t _Sz,
typename _U
int,
typename... _UInts>
1929 struct __select<_Sz, _List<_Uint, _UInts...>,
true>
1930 {
using __type = _Uint; };
1932 template<
size_t _Sz,
typename _Uint,
typename... _UInts>
1933 struct __select<_Sz, _List<_Uint, _UInts...>, false>
1934 : __select<_Sz, _List<_UInts...>>
1939 template<
typename _Tp>
1940 class __make_unsigned_selector<_Tp, false, true>
1941 : __make_unsigned_selector_base
1944 using _UInts = _List<
unsigned char,
unsigned short,
unsigned int,
1945 unsigned long,
unsigned long long>;
1947 using __unsigned_type =
typename __select<
sizeof(_Tp), _UInts>::__type;
1951 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1959 struct __make_unsigned<wchar_t>
1962 =
typename __make_unsigned_selector<wchar_t, false, true>::__type;
1965#ifdef _GLIBCXX_USE_CHAR8_T
1967 struct __make_unsigned<char8_t>
1970 =
typename __make_unsigned_selector<char8_t, false, true>::__type;
1975 struct __make_unsigned<char16_t>
1978 =
typename __make_unsigned_selector<char16_t, false, true>::__type;
1982 struct __make_unsigned<char32_t>
1985 =
typename __make_unsigned_selector<char32_t, false, true>::__type;
1993 template<
typename _Tp>
1995 {
using type =
typename __make_unsigned_selector<_Tp>::__type; };
2006 template<
typename _Tp>
2007 struct __make_signed
2008 {
using __type = _Tp; };
2011 struct __make_signed<char>
2012 {
using __type =
signed char; };
2015 struct __make_signed<unsigned char>
2016 {
using __type =
signed char; };
2019 struct __make_signed<unsigned short>
2020 {
using __type =
signed short; };
2023 struct __make_signed<unsigned int>
2024 {
using __type =
signed int; };
2027 struct __make_signed<unsigned long>
2028 {
using __type =
signed long; };
2031 struct __make_signed<unsigned long long>
2032 {
using __type =
signed long long; };
2034#if defined(__GLIBCXX_TYPE_INT_N_0)
2037 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
2038 {
using __type = __GLIBCXX_TYPE_INT_N_0; };
2040#if defined(__GLIBCXX_TYPE_INT_N_1)
2043 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
2044 {
using __type = __GLIBCXX_TYPE_INT_N_1; };
2046#if defined(__GLIBCXX_TYPE_INT_N_2)
2049 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
2050 {
using __type = __GLIBCXX_TYPE_INT_N_2; };
2052#if defined(__GLIBCXX_TYPE_INT_N_3)
2055 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
2056 {
using __type = __GLIBCXX_TYPE_INT_N_3; };
2060 template<
typename _Tp,
2061 bool _IsInt = is_integral<_Tp>::value,
2062 bool _IsEnum = __is_enum(_Tp)>
2063 class __make_signed_selector;
2065 template<
typename _Tp>
2066 class __make_signed_selector<_Tp, true, false>
2069 =
typename __make_signed<__remove_cv_t<_Tp>>::__type;
2073 =
typename __match_cv_qualifiers<_Tp, __signed_type>::__type;
2077 template<
typename _Tp>
2078 class __make_signed_selector<_Tp, false, true>
2080 using __unsigned_type =
typename __make_unsigned_selector<_Tp>::__type;
2083 using __type =
typename __make_signed_selector<__unsigned_type>::__type;
2091 struct __make_signed<wchar_t>
2094 =
typename __make_signed_selector<wchar_t, false, true>::__type;
2097#if defined(_GLIBCXX_USE_CHAR8_T)
2099 struct __make_signed<char8_t>
2102 =
typename __make_signed_selector<char8_t, false, true>::__type;
2107 struct __make_signed<char16_t>
2110 =
typename __make_signed_selector<char16_t, false, true>::__type;
2114 struct __make_signed<char32_t>
2117 =
typename __make_signed_selector<char32_t, false, true>::__type;
2125 template<
typename _Tp>
2127 {
using type =
typename __make_signed_selector<_Tp>::__type; };
2133 template<>
struct make_signed<bool const volatile>;
2135#if __cplusplus > 201103L
2137 template<
typename _Tp>
2141 template<
typename _Tp>
2148#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_extent)
2149 template<
typename _Tp>
2151 {
using type = __remove_extent(_Tp); };
2153 template<
typename _Tp>
2155 {
using type = _Tp; };
2157 template<
typename _Tp, std::
size_t _Size>
2159 {
using type = _Tp; };
2161 template<
typename _Tp>
2162 struct remove_extent<_Tp[]>
2163 {
using type = _Tp; };
2167#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
2168 template<
typename _Tp>
2169 struct remove_all_extents
2170 {
using type = __remove_all_extents(_Tp); };
2172 template<
typename _Tp>
2174 {
using type = _Tp; };
2176 template<
typename _Tp, std::
size_t _Size>
2178 {
using type =
typename remove_all_extents<_Tp>::type; };
2180 template<
typename _Tp>
2181 struct remove_all_extents<_Tp[]>
2182 {
using type =
typename remove_all_extents<_Tp>::type; };
2185#if __cplusplus > 201103L
2187 template<
typename _Tp>
2191 template<
typename _Tp>
2198#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_pointer)
2199 template<
typename _Tp>
2200 struct remove_pointer
2201 {
using type = __remove_pointer(_Tp); };
2203 template<
typename _Tp,
typename>
2205 {
using type = _Tp; };
2207 template<
typename _Tp,
typename _Up>
2209 {
using type = _Up; };
2211 template<
typename _Tp>
2212 struct remove_pointer
2213 :
public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>>
2218#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer)
2219 template<
typename _Tp>
2221 {
using type = __add_pointer(_Tp); };
2223 template<
typename _Tp,
typename =
void>
2225 {
using type = _Tp; };
2227 template<
typename _Tp>
2229 {
using type = _Tp*; };
2231 template<
typename _Tp>
2233 :
public __add_pointer_helper<_Tp>
2236 template<
typename _Tp>
2237 struct add_pointer<_Tp&>
2238 {
using type = _Tp*; };
2240 template<
typename _Tp>
2241 struct add_pointer<_Tp&&>
2242 {
using type = _Tp*; };
2245#if __cplusplus > 201103L
2247 template<
typename _Tp>
2251 template<
typename _Tp>
2258 struct __attribute__((__aligned__)) __aligned_storage_max_align_t
2262 __aligned_storage_default_alignment([[__maybe_unused__]]
size_t __len)
2264#if _GLIBCXX_INLINE_VERSION
2266 = integral_constant<size_t,
alignof(__aligned_storage_max_align_t)>;
2268 return __len > (_Max_align::value / 2)
2270#
if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_clzg)
2271 : 1 << (__SIZE_WIDTH__ - __builtin_clzg(__len - 1u));
2273 : 1 << (__LLONG_WIDTH__ - __builtin_clzll(__len - 1ull));
2278 return alignof(__aligned_storage_max_align_t);
2314 template<
size_t _Len,
2315 size_t _Align = __aligned_storage_default_alignment(_Len)>
2317 _GLIBCXX23_DEPRECATED
2322 alignas(_Align)
unsigned char __data[_Len];
2326 template <
typename... _Types>
2327 struct __strictest_alignment
2329 static const size_t _S_alignment = 0;
2330 static const size_t _S_size = 0;
2333 template <
typename _Tp,
typename... _Types>
2334 struct __strictest_alignment<_Tp, _Types...>
2336 static const size_t _S_alignment =
2337 alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
2338 ?
alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
2339 static const size_t _S_size =
2340 sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
2341 ?
sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
2344#pragma GCC diagnostic push
2345#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2359 template <
size_t _Len,
typename... _Types>
2361 _GLIBCXX23_DEPRECATED
2365 static_assert(
sizeof...(_Types) != 0,
"At least one type is required");
2367 using __strictest = __strictest_alignment<_Types...>;
2368 static const size_t _S_len = _Len > __strictest::_S_size
2369 ? _Len : __strictest::_S_size;
2372 static const size_t alignment_value = __strictest::_S_alignment;
2377 template <
size_t _Len,
typename... _Types>
2378 const size_t aligned_union<_Len, _Types...>::alignment_value;
2379#pragma GCC diagnostic pop
2383#if _GLIBCXX_USE_BUILTIN_TRAIT(__decay)
2384 template<
typename _Tp>
2386 {
using type = __decay(_Tp); };
2390 template<
typename _Up>
2391 struct __decay_selector
2392 : __conditional_t<is_const<const _Up>::value,
2397 template<
typename _Up,
size_t _Nm>
2398 struct __decay_selector<_Up[_Nm]>
2399 {
using type = _Up*; };
2401 template<
typename _Up>
2402 struct __decay_selector<_Up[]>
2403 {
using type = _Up*; };
2408 template<
typename _Tp>
2410 {
using type =
typename __decay_selector<_Tp>::type; };
2412 template<
typename _Tp>
2414 {
using type =
typename __decay_selector<_Tp>::type; };
2416 template<
typename _Tp>
2418 {
using type =
typename __decay_selector<_Tp>::type; };
2424 template<
typename _Tp>
2425 struct __strip_reference_wrapper
2430 template<
typename _Tp>
2431 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
2433 using __type = _Tp&;
2437 template<
typename _Tp>
2438 using __decay_t =
typename decay<_Tp>::type;
2440 template<
typename _Tp>
2441 using __decay_and_strip = __strip_reference_wrapper<__decay_t<_Tp>>;
2447 template<
typename... _Cond>
2448 using _Require = __enable_if_t<__and_<_Cond...>::value>;
2451 template<
typename _Tp>
2452 using __remove_cvref_t
2453 =
typename remove_cv<typename remove_reference<_Tp>::type>::type;
2458 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2460 {
using type = _Iftrue; };
2463 template<
typename _Iftrue,
typename _Iffalse>
2465 {
using type = _Iffalse; };
2468 template<
typename... _Tp>
2480 template<
typename _Tp>
2481 struct __success_type
2482 {
using type = _Tp; };
2484 struct __failure_type
2487 struct __do_common_type_impl
2489 template<
typename _Tp,
typename _Up>
2491 =
decltype(
true ? std::declval<_Tp>() :
std::declval<_Up>());
2495 template<
typename _Tp,
typename _Up>
2496 static __success_type<__decay_t<__cond_t<_Tp, _Up>>>
2499#if __cplusplus > 201703L
2502 template<
typename _Tp,
typename _Up>
2503 static __success_type<__remove_cvref_t<__cond_t<const _Tp&, const _Up&>>>
2507 template<
typename,
typename>
2508 static __failure_type
2511 template<
typename _Tp,
typename _Up>
2512 static decltype(_S_test_2<_Tp, _Up>(0))
2518 struct common_type<>
2522 template<
typename _Tp0>
2523 struct common_type<_Tp0>
2524 :
public common_type<_Tp0, _Tp0>
2528 template<
typename _Tp1,
typename _Tp2,
2529 typename _Dp1 = __decay_t<_Tp1>,
typename _Dp2 = __decay_t<_Tp2>>
2530 struct __common_type_impl
2534 using type = common_type<_Dp1, _Dp2>;
2537 template<
typename _Tp1,
typename _Tp2>
2538 struct __common_type_impl<_Tp1, _Tp2, _Tp1, _Tp2>
2539 :
private __do_common_type_impl
2543 using type =
decltype(_S_test<_Tp1, _Tp2>(0));
2547 template<
typename _Tp1,
typename _Tp2>
2548 struct common_type<_Tp1, _Tp2>
2549 :
public __common_type_impl<_Tp1, _Tp2>::type
2552 template<
typename...>
2553 struct __common_type_pack
2556 template<
typename,
typename,
typename =
void>
2557 struct __common_type_fold;
2560 template<
typename _Tp1,
typename _Tp2,
typename... _Rp>
2561 struct common_type<_Tp1, _Tp2, _Rp...>
2562 :
public __common_type_fold<common_type<_Tp1, _Tp2>,
2563 __common_type_pack<_Rp...>>
2569 template<
typename _CTp,
typename... _Rp>
2570 struct __common_type_fold<_CTp, __common_type_pack<_Rp...>,
2571 __void_t<typename _CTp::type>>
2572 :
public common_type<typename _CTp::type, _Rp...>
2576 template<
typename _CTp,
typename _Rp>
2577 struct __common_type_fold<_CTp, _Rp, void>
2580 template<
typename _Tp,
bool = __is_enum(_Tp)>
2581 struct __underlying_type_impl
2583 using type = __underlying_type(_Tp);
2586 template<
typename _Tp>
2587 struct __underlying_type_impl<_Tp, false>
2592 template<
typename _Tp>
2594 :
public __underlying_type_impl<_Tp>
2598 template<
typename _Tp>
2599 struct __declval_protector
2601 static const bool __stop =
false;
2609 template<
typename _Tp>
2610 auto declval() noexcept -> decltype(__declval<_Tp>(0))
2612 static_assert(__declval_protector<_Tp>::__stop,
2613 "declval() must not be used!");
2614 return __declval<_Tp>(0);
2618 template<
typename _Signature>
2624 struct __invoke_memfun_ref { };
2625 struct __invoke_memfun_deref { };
2626 struct __invoke_memobj_ref { };
2627 struct __invoke_memobj_deref { };
2628 struct __invoke_other { };
2631 template<
typename _Tp,
typename _Tag>
2632 struct __result_of_success : __success_type<_Tp>
2633 {
using __invoke_type = _Tag; };
2636 struct __result_of_memfun_ref_impl
2638 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2639 static __result_of_success<
decltype(
2640 (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
2641 ), __invoke_memfun_ref> _S_test(
int);
2643 template<
typename...>
2644 static __failure_type _S_test(...);
2647 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2648 struct __result_of_memfun_ref
2649 :
private __result_of_memfun_ref_impl
2651 using type =
decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2655 struct __result_of_memfun_deref_impl
2657 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2658 static __result_of_success<
decltype(
2659 ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
2660 ), __invoke_memfun_deref> _S_test(
int);
2662 template<
typename...>
2663 static __failure_type _S_test(...);
2666 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2667 struct __result_of_memfun_deref
2668 :
private __result_of_memfun_deref_impl
2670 using type =
decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2674 struct __result_of_memobj_ref_impl
2676 template<
typename _Fp,
typename _Tp1>
2677 static __result_of_success<
decltype(
2678 std::declval<_Tp1>().*std::declval<_Fp>()
2679 ), __invoke_memobj_ref> _S_test(
int);
2681 template<
typename,
typename>
2682 static __failure_type _S_test(...);
2685 template<
typename _MemPtr,
typename _Arg>
2686 struct __result_of_memobj_ref
2687 :
private __result_of_memobj_ref_impl
2689 using type =
decltype(_S_test<_MemPtr, _Arg>(0));
2693 struct __result_of_memobj_deref_impl
2695 template<
typename _Fp,
typename _Tp1>
2696 static __result_of_success<
decltype(
2697 (*std::declval<_Tp1>()).*std::declval<_Fp>()
2698 ), __invoke_memobj_deref> _S_test(
int);
2700 template<
typename,
typename>
2701 static __failure_type _S_test(...);
2704 template<
typename _MemPtr,
typename _Arg>
2705 struct __result_of_memobj_deref
2706 :
private __result_of_memobj_deref_impl
2708 using type =
decltype(_S_test<_MemPtr, _Arg>(0));
2711 template<
typename _MemPtr,
typename _Arg>
2712 struct __result_of_memobj;
2714 template<
typename _Res,
typename _Class,
typename _Arg>
2715 struct __result_of_memobj<_Res _Class::*, _Arg>
2717 using _Argval = __remove_cvref_t<_Arg>;
2718 using _MemPtr = _Res _Class::*;
2719 using type =
typename __conditional_t<__or_<is_same<_Argval, _Class>,
2720 is_base_of<_Class, _Argval>>::value,
2721 __result_of_memobj_ref<_MemPtr, _Arg>,
2722 __result_of_memobj_deref<_MemPtr, _Arg>
2726 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2727 struct __result_of_memfun;
2729 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2730 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2732 using _Argval =
typename remove_reference<_Arg>::type;
2733 using _MemPtr = _Res _Class::*;
2734 using type =
typename __conditional_t<is_base_of<_Class, _Argval>::value,
2735 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2736 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2745 template<
typename _Tp,
typename _Up = __remove_cvref_t<_Tp>>
2751 template<
typename _Tp,
typename _Up>
2752 struct __inv_unwrap<_Tp, reference_wrapper<_Up>>
2757 template<bool, bool,
typename _Functor,
typename... _ArgTypes>
2758 struct __result_of_impl
2760 using type = __failure_type;
2763 template<
typename _MemPtr,
typename _Arg>
2764 struct __result_of_impl<true, false, _MemPtr, _Arg>
2765 :
public __result_of_memobj<__decay_t<_MemPtr>,
2766 typename __inv_unwrap<_Arg>::type>
2769 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2770 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2771 :
public __result_of_memfun<__decay_t<_MemPtr>,
2772 typename __inv_unwrap<_Arg>::type, _Args...>
2776 struct __result_of_other_impl
2778 template<
typename _Fn,
typename... _Args>
2779 static __result_of_success<
decltype(
2780 std::declval<_Fn>()(std::declval<_Args>()...)
2781 ), __invoke_other> _S_test(
int);
2783 template<
typename...>
2784 static __failure_type _S_test(...);
2787 template<
typename _Functor,
typename... _ArgTypes>
2788 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2789 :
private __result_of_other_impl
2791 using type =
decltype(_S_test<_Functor, _ArgTypes...>(0));
2795 template<
typename _Functor,
typename... _ArgTypes>
2796 struct __invoke_result
2797 :
public __result_of_impl<
2798 is_member_object_pointer<
2799 typename remove_reference<_Functor>::type
2801 is_member_function_pointer<
2802 typename remove_reference<_Functor>::type
2804 _Functor, _ArgTypes...
2809 template<
typename _Fn,
typename... _Args>
2810 using __invoke_result_t =
typename __invoke_result<_Fn, _Args...>::type;
2813 template<
typename _Functor,
typename... _ArgTypes>
2814 struct result_of<_Functor(_ArgTypes...)>
2815 :
public __invoke_result<_Functor, _ArgTypes...>
2816 { } _GLIBCXX17_DEPRECATED_SUGGEST(
"std::invoke_result");
2818#if __cplusplus >= 201402L
2819#pragma GCC diagnostic push
2820#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2822 template<
size_t _Len,
2823 size_t _Align = __aligned_storage_default_alignment(_Len)>
2826 template <
size_t _Len,
typename... _Types>
2827 using aligned_union_t _GLIBCXX23_DEPRECATED =
typename aligned_union<_Len, _Types...>::type;
2828#pragma GCC diagnostic pop
2831 template<
typename _Tp>
2835 template<
bool _Cond,
typename _Tp =
void>
2839 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2843 template<
typename... _Tp>
2847 template<
typename _Tp>
2851 template<
typename _Tp>
2855#ifdef __cpp_lib_void_t
2857 template<typename...> using void_t = void;
2867 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
2868 struct __detected_or
2875 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
2876 requires requires {
typename _Op<_Args...>; }
2877 struct __detected_or<_Def, _Op, _Args...>
2879 using type = _Op<_Args...>;
2884 template<
typename _Default,
typename _AlwaysVoid,
2885 template<
typename...>
class _Op,
typename... _Args>
2888 using type = _Default;
2893 template<
typename _Default,
template<
typename...>
class _Op,
2895 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
2897 using type = _Op<_Args...>;
2901 template<
typename _Default,
template<
typename...>
class _Op,
2903 using __detected_or = __detector<_Default, void, _Op, _Args...>;
2907 template<
typename _Default,
template<
typename...>
class _Op,
2909 using __detected_or_t
2910 =
typename __detected_or<_Default, _Op, _Args...>::type;
2916#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
2917 template<typename _Tp, typename = __void_t<>> \
2918 struct __has_##_NTYPE \
2921 template<typename _Tp> \
2922 struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
2926 template <
typename _Tp>
2927 struct __is_swappable;
2929 template <
typename _Tp>
2930 struct __is_nothrow_swappable;
2937 template<
typename _Tp>
2938 struct __is_tuple_like
2939 :
public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type
2943 template<
typename _Tp>
2944 _GLIBCXX20_CONSTEXPR
2946 _Require<__not_<__is_tuple_like<_Tp>>,
2947 is_move_constructible<_Tp>,
2948 is_move_assignable<_Tp>>
2950 noexcept(__and_<is_nothrow_move_constructible<_Tp>,
2951 is_nothrow_move_assignable<_Tp>>::value);
2953 template<
typename _Tp,
size_t _Nm>
2954 _GLIBCXX20_CONSTEXPR
2956 __enable_if_t<__is_swappable<_Tp>::value>
2957 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
2958 noexcept(__is_nothrow_swappable<_Tp>::value);
2961 namespace __swappable_details {
2964 struct __do_is_swappable_impl
2966 template<
typename _Tp,
typename
2967 =
decltype(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
2968 static true_type __test(
int);
2974 struct __do_is_nothrow_swappable_impl
2976 template<
typename _Tp>
2977 static __bool_constant<
2978 noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
2987 template<
typename _Tp>
2988 struct __is_swappable_impl
2989 :
public __swappable_details::__do_is_swappable_impl
2991 using type =
decltype(__test<_Tp>(0));
2994 template<
typename _Tp>
2995 struct __is_nothrow_swappable_impl
2996 :
public __swappable_details::__do_is_nothrow_swappable_impl
2998 using type =
decltype(__test<_Tp>(0));
3001 template<
typename _Tp>
3002 struct __is_swappable
3003 :
public __is_swappable_impl<_Tp>::type
3006 template<
typename _Tp>
3007 struct __is_nothrow_swappable
3008 :
public __is_nothrow_swappable_impl<_Tp>::type
3012#ifdef __cpp_lib_is_swappable
3016 template<
typename _Tp>
3018 :
public __is_swappable_impl<_Tp>::type
3020 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3021 "template argument must be a complete class or an unbounded array");
3025 template<
typename _Tp>
3026 struct is_nothrow_swappable
3027 :
public __is_nothrow_swappable_impl<_Tp>::type
3029 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3030 "template argument must be a complete class or an unbounded array");
3033#if __cplusplus >= 201402L
3035 template<
typename _Tp>
3036 _GLIBCXX17_INLINE
constexpr bool is_swappable_v =
3037 is_swappable<_Tp>::value;
3040 template<
typename _Tp>
3041 _GLIBCXX17_INLINE
constexpr bool is_nothrow_swappable_v =
3042 is_nothrow_swappable<_Tp>::value;
3046 namespace __swappable_with_details {
3049 struct __do_is_swappable_with_impl
3051 template<
typename _Tp,
typename _Up,
typename
3052 =
decltype(swap(std::declval<_Tp>(), std::declval<_Up>())),
3054 =
decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))>
3057 template<
typename,
typename>
3061 struct __do_is_nothrow_swappable_with_impl
3063 template<
typename _Tp,
typename _Up>
3064 static __bool_constant<
3065 noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))
3067 noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()))
3070 template<
typename,
typename>
3076 template<
typename _Tp,
typename _Up>
3077 struct __is_swappable_with_impl
3078 :
public __swappable_with_details::__do_is_swappable_with_impl
3080 using type =
decltype(__test<_Tp, _Up>(0));
3084 template<
typename _Tp>
3085 struct __is_swappable_with_impl<_Tp&, _Tp&>
3086 :
public __swappable_details::__do_is_swappable_impl
3088 using type =
decltype(__test<_Tp&>(0));
3091 template<
typename _Tp,
typename _Up>
3092 struct __is_nothrow_swappable_with_impl
3093 :
public __swappable_with_details::__do_is_nothrow_swappable_with_impl
3095 using type =
decltype(__test<_Tp, _Up>(0));
3099 template<
typename _Tp>
3100 struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
3101 :
public __swappable_details::__do_is_nothrow_swappable_impl
3103 using type =
decltype(__test<_Tp&>(0));
3108 template<
typename _Tp,
typename _Up>
3109 struct is_swappable_with
3110 :
public __is_swappable_with_impl<_Tp, _Up>::type
3112 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3113 "first template argument must be a complete class or an unbounded array");
3114 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3115 "second template argument must be a complete class or an unbounded array");
3119 template<
typename _Tp,
typename _Up>
3120 struct is_nothrow_swappable_with
3121 :
public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
3123 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3124 "first template argument must be a complete class or an unbounded array");
3125 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3126 "second template argument must be a complete class or an unbounded array");
3129#if __cplusplus >= 201402L
3131 template<
typename _Tp,
typename _Up>
3132 _GLIBCXX17_INLINE
constexpr bool is_swappable_with_v =
3133 is_swappable_with<_Tp, _Up>::value;
3136 template<
typename _Tp,
typename _Up>
3137 _GLIBCXX17_INLINE
constexpr bool is_nothrow_swappable_with_v =
3138 is_nothrow_swappable_with<_Tp, _Up>::value;
3148 template<
typename _Result,
typename _Ret,
3149 bool = is_void<_Ret>::value,
typename =
void>
3150 struct __is_invocable_impl
3157 template<
typename _Result,
typename _Ret>
3158 struct __is_invocable_impl<_Result, _Ret,
3160 __void_t<typename _Result::type>>
3166#pragma GCC diagnostic push
3167#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3169 template<
typename _Result,
typename _Ret>
3170 struct __is_invocable_impl<_Result, _Ret,
3172 __void_t<typename _Result::type>>
3176 using _Res_t =
typename _Result::type;
3180 static _Res_t _S_get() noexcept;
3183 template<typename _Tp>
3184 static
void _S_conv(__type_identity_t<_Tp>) noexcept;
3187 template<typename _Tp,
3188 bool _Nothrow = noexcept(_S_conv<_Tp>(_S_get())),
3189 typename = decltype(_S_conv<_Tp>(_S_get())),
3190#if __has_builtin(__reference_converts_from_temporary)
3191 bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
3193 bool _Dangle =
false
3196 static __bool_constant<_Nothrow && !_Dangle>
3199 template<
typename _Tp,
bool = false>
3205 using type =
decltype(_S_test<_Ret,
true>(1));
3208 using __nothrow_conv =
decltype(_S_test<_Ret>(1));
3210#pragma GCC diagnostic pop
3212 template<
typename _Fn,
typename... _ArgTypes>
3213 struct __is_invocable
3214 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3217 template<
typename _Fn,
typename _Tp,
typename... _Args>
3218 constexpr bool __call_is_nt(__invoke_memfun_ref)
3220 using _Up =
typename __inv_unwrap<_Tp>::type;
3221 return noexcept((std::declval<_Up>().*std::declval<_Fn>())(
3222 std::declval<_Args>()...));
3225 template<
typename _Fn,
typename _Tp,
typename... _Args>
3226 constexpr bool __call_is_nt(__invoke_memfun_deref)
3228 return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())(
3229 std::declval<_Args>()...));
3232 template<
typename _Fn,
typename _Tp>
3233 constexpr bool __call_is_nt(__invoke_memobj_ref)
3235 using _Up =
typename __inv_unwrap<_Tp>::type;
3236 return noexcept(std::declval<_Up>().*std::declval<_Fn>());
3239 template<
typename _Fn,
typename _Tp>
3240 constexpr bool __call_is_nt(__invoke_memobj_deref)
3242 return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>());
3245 template<
typename _Fn,
typename... _Args>
3246 constexpr bool __call_is_nt(__invoke_other)
3248 return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
3251 template<
typename _Result,
typename _Fn,
typename... _Args>
3252 struct __call_is_nothrow
3254 std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
3258 template<
typename _Fn,
typename... _Args>
3259 using __call_is_nothrow_
3260 = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
3263 template<
typename _Fn,
typename... _Args>
3264 struct __is_nothrow_invocable
3265 : __and_<__is_invocable<_Fn, _Args...>,
3266 __call_is_nothrow_<_Fn, _Args...>>::type
3269#pragma GCC diagnostic push
3270#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3271 struct __nonesuchbase {};
3272 struct __nonesuch :
private __nonesuchbase {
3273 ~__nonesuch() =
delete;
3274 __nonesuch(__nonesuch
const&) =
delete;
3275 void operator=(__nonesuch
const&) =
delete;
3277#pragma GCC diagnostic pop
3280#ifdef __cpp_lib_is_invocable
3282 template<typename _Functor, typename... _ArgTypes>
3283 struct invoke_result
3284 :
public __invoke_result<_Functor, _ArgTypes...>
3286 static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
3287 "_Functor must be a complete class or an unbounded array");
3288 static_assert((std::__is_complete_or_unbounded(
3289 __type_identity<_ArgTypes>{}) && ...),
3290 "each argument type must be a complete class or an unbounded array");
3294 template<
typename _Fn,
typename... _Args>
3295 using invoke_result_t =
typename invoke_result<_Fn, _Args...>::type;
3298 template<
typename _Fn,
typename... _ArgTypes>
3300#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3301 :
public __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
3303 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3306 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3307 "_Fn must be a complete class or an unbounded array");
3308 static_assert((std::__is_complete_or_unbounded(
3309 __type_identity<_ArgTypes>{}) && ...),
3310 "each argument type must be a complete class or an unbounded array");
3314 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3315 struct is_invocable_r
3316 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
3318 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3319 "_Fn must be a complete class or an unbounded array");
3320 static_assert((std::__is_complete_or_unbounded(
3321 __type_identity<_ArgTypes>{}) && ...),
3322 "each argument type must be a complete class or an unbounded array");
3323 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3324 "_Ret must be a complete class or an unbounded array");
3328 template<
typename _Fn,
typename... _ArgTypes>
3329 struct is_nothrow_invocable
3330#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3331 :
public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)>
3333 : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
3334 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3337 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3338 "_Fn must be a complete class or an unbounded array");
3339 static_assert((std::__is_complete_or_unbounded(
3340 __type_identity<_ArgTypes>{}) && ...),
3341 "each argument type must be a complete class or an unbounded array");
3348 template<
typename _Result,
typename _Ret>
3349 using __is_nt_invocable_impl
3350 =
typename __is_invocable_impl<_Result, _Ret>::__nothrow_conv;
3354 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3355 struct is_nothrow_invocable_r
3356 : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
3357 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3359 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3360 "_Fn must be a complete class or an unbounded array");
3361 static_assert((std::__is_complete_or_unbounded(
3362 __type_identity<_ArgTypes>{}) && ...),
3363 "each argument type must be a complete class or an unbounded array");
3364 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3365 "_Ret must be a complete class or an unbounded array");
3369#if __cpp_lib_type_trait_variable_templates
3384template <
typename _Tp>
3385 inline constexpr bool is_void_v = is_void<_Tp>::value;
3386template <
typename _Tp>
3387 inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
3388template <
typename _Tp>
3389 inline constexpr bool is_integral_v = is_integral<_Tp>::value;
3390template <
typename _Tp>
3391 inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
3393#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
3394template <
typename _Tp>
3395 inline constexpr bool is_array_v = __is_array(_Tp);
3397template <
typename _Tp>
3398 inline constexpr bool is_array_v =
false;
3399template <
typename _Tp>
3400 inline constexpr bool is_array_v<_Tp[]> =
true;
3401template <
typename _Tp,
size_t _Num>
3402 inline constexpr bool is_array_v<_Tp[_Num]> =
true;
3405#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
3406template <
typename _Tp>
3407 inline constexpr bool is_pointer_v = __is_pointer(_Tp);
3409template <
typename _Tp>
3410 inline constexpr bool is_pointer_v =
false;
3411template <
typename _Tp>
3412 inline constexpr bool is_pointer_v<_Tp*> =
true;
3413template <
typename _Tp>
3414 inline constexpr bool is_pointer_v<_Tp* const> =
true;
3415template <
typename _Tp>
3416 inline constexpr bool is_pointer_v<_Tp* volatile> =
true;
3417template <
typename _Tp>
3418 inline constexpr bool is_pointer_v<_Tp* const volatile> =
true;
3421template <
typename _Tp>
3422 inline constexpr bool is_lvalue_reference_v =
false;
3423template <
typename _Tp>
3424 inline constexpr bool is_lvalue_reference_v<_Tp&> =
true;
3425template <
typename _Tp>
3426 inline constexpr bool is_rvalue_reference_v =
false;
3427template <
typename _Tp>
3428 inline constexpr bool is_rvalue_reference_v<_Tp&&> =
true;
3430#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
3431template <
typename _Tp>
3432 inline constexpr bool is_member_object_pointer_v =
3433 __is_member_object_pointer(_Tp);
3435template <
typename _Tp>
3436 inline constexpr bool is_member_object_pointer_v =
3437 is_member_object_pointer<_Tp>::value;
3440#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
3441template <
typename _Tp>
3442 inline constexpr bool is_member_function_pointer_v =
3443 __is_member_function_pointer(_Tp);
3445template <
typename _Tp>
3446 inline constexpr bool is_member_function_pointer_v =
3447 is_member_function_pointer<_Tp>::value;
3450template <
typename _Tp>
3451 inline constexpr bool is_enum_v = __is_enum(_Tp);
3452template <
typename _Tp>
3453 inline constexpr bool is_union_v = __is_union(_Tp);
3454template <
typename _Tp>
3455 inline constexpr bool is_class_v = __is_class(_Tp);
3458#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
3459template <
typename _Tp>
3460 inline constexpr bool is_reference_v = __is_reference(_Tp);
3462template <
typename _Tp>
3463 inline constexpr bool is_reference_v =
false;
3464template <
typename _Tp>
3465 inline constexpr bool is_reference_v<_Tp&> =
true;
3466template <
typename _Tp>
3467 inline constexpr bool is_reference_v<_Tp&&> =
true;
3470template <
typename _Tp>
3471 inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
3472template <
typename _Tp>
3473 inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
3475#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
3476template <
typename _Tp>
3477 inline constexpr bool is_object_v = __is_object(_Tp);
3479template <
typename _Tp>
3480 inline constexpr bool is_object_v = is_object<_Tp>::value;
3483template <
typename _Tp>
3484 inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
3485template <
typename _Tp>
3486 inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
3488#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
3489template <
typename _Tp>
3490 inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
3492template <
typename _Tp>
3493 inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
3496#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
3497template <
typename _Tp>
3498 inline constexpr bool is_const_v = __is_const(_Tp);
3500template <
typename _Tp>
3501 inline constexpr bool is_const_v =
false;
3502template <
typename _Tp>
3503 inline constexpr bool is_const_v<const _Tp> =
true;
3506#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
3507template <
typename _Tp>
3508 inline constexpr bool is_function_v = __is_function(_Tp);
3510template <
typename _Tp>
3511 inline constexpr bool is_function_v = !is_const_v<const _Tp>;
3512template <
typename _Tp>
3513 inline constexpr bool is_function_v<_Tp&> =
false;
3514template <
typename _Tp>
3515 inline constexpr bool is_function_v<_Tp&&> =
false;
3518#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
3519template <
typename _Tp>
3520 inline constexpr bool is_volatile_v = __is_volatile(_Tp);
3522template <
typename _Tp>
3523 inline constexpr bool is_volatile_v =
false;
3524template <
typename _Tp>
3525 inline constexpr bool is_volatile_v<volatile _Tp> =
true;
3528template <
typename _Tp>
3529 _GLIBCXX26_DEPRECATED_SUGGEST(
"is_trivially_default_constructible_v && is_trivially_copyable_v")
3530 inline constexpr
bool is_trivial_v = __is_trivial(_Tp);
3531template <typename _Tp>
3532 inline constexpr
bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
3533template <typename _Tp>
3534 inline constexpr
bool is_standard_layout_v = __is_standard_layout(_Tp);
3535template <typename _Tp>
3536 _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout_v && is_trivial_v")
3537 inline constexpr
bool is_pod_v = __is_pod(_Tp);
3538template <typename _Tp>
3539 _GLIBCXX17_DEPRECATED
3540 inline constexpr
bool is_literal_type_v = __is_literal_type(_Tp);
3541template <typename _Tp>
3542 inline constexpr
bool is_empty_v = __is_empty(_Tp);
3543template <typename _Tp>
3544 inline constexpr
bool is_polymorphic_v = __is_polymorphic(_Tp);
3545template <typename _Tp>
3546 inline constexpr
bool is_abstract_v = __is_abstract(_Tp);
3547template <typename _Tp>
3548 inline constexpr
bool is_final_v = __is_final(_Tp);
3550template <typename _Tp>
3551 inline constexpr
bool is_signed_v = is_signed<_Tp>::value;
3552template <typename _Tp>
3553 inline constexpr
bool is_unsigned_v = is_unsigned<_Tp>::value;
3555template <typename _Tp, typename... _Args>
3556 inline constexpr
bool is_constructible_v = __is_constructible(_Tp, _Args...);
3557template <typename _Tp>
3558 inline constexpr
bool is_default_constructible_v = __is_constructible(_Tp);
3559template <typename _Tp>
3560 inline constexpr
bool is_copy_constructible_v
3561 = __is_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3562template <typename _Tp>
3563 inline constexpr
bool is_move_constructible_v
3564 = __is_constructible(_Tp, __add_rval_ref_t<_Tp>);
3566template <typename _Tp, typename _Up>
3567 inline constexpr
bool is_assignable_v = __is_assignable(_Tp, _Up);
3568template <typename _Tp>
3569 inline constexpr
bool is_copy_assignable_v
3570 = __is_assignable(__add_lval_ref_t<_Tp>, __add_lval_ref_t<const _Tp>);
3571template <typename _Tp>
3572 inline constexpr
bool is_move_assignable_v
3573 = __is_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3575template <typename _Tp>
3576 inline constexpr
bool is_destructible_v = is_destructible<_Tp>::value;
3578template <typename _Tp, typename... _Args>
3579 inline constexpr
bool is_trivially_constructible_v
3580 = __is_trivially_constructible(_Tp, _Args...);
3581template <typename _Tp>
3582 inline constexpr
bool is_trivially_default_constructible_v
3583 = __is_trivially_constructible(_Tp);
3584template <typename _Tp>
3585 inline constexpr
bool is_trivially_copy_constructible_v
3586 = __is_trivially_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3587template <typename _Tp>
3588 inline constexpr
bool is_trivially_move_constructible_v
3589 = __is_trivially_constructible(_Tp, __add_rval_ref_t<_Tp>);
3591template <typename _Tp, typename _Up>
3592 inline constexpr
bool is_trivially_assignable_v
3593 = __is_trivially_assignable(_Tp, _Up);
3594template <typename _Tp>
3595 inline constexpr
bool is_trivially_copy_assignable_v
3596 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3597 __add_lval_ref_t<const _Tp>);
3598template <typename _Tp>
3599 inline constexpr
bool is_trivially_move_assignable_v
3600 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3601 __add_rval_ref_t<_Tp>);
3604template <
typename _Tp>
3605 inline constexpr bool is_trivially_destructible_v =
false;
3607template <
typename _Tp>
3608 requires (!is_reference_v<_Tp>) &&
requires (_Tp& __t) { __t.~_Tp(); }
3609 inline constexpr bool is_trivially_destructible_v<_Tp>
3610 = __has_trivial_destructor(_Tp);
3611template <
typename _Tp>
3612 inline constexpr bool is_trivially_destructible_v<_Tp&> =
true;
3613template <
typename _Tp>
3614 inline constexpr bool is_trivially_destructible_v<_Tp&&> =
true;
3615template <
typename _Tp,
size_t _Nm>
3616 inline constexpr bool is_trivially_destructible_v<_Tp[_Nm]>
3617 = is_trivially_destructible_v<_Tp>;
3619template <
typename _Tp>
3620 inline constexpr bool is_trivially_destructible_v =
3621 is_trivially_destructible<_Tp>::value;
3624template <
typename _Tp,
typename... _Args>
3625 inline constexpr bool is_nothrow_constructible_v
3626 = __is_nothrow_constructible(_Tp, _Args...);
3627template <
typename _Tp>
3628 inline constexpr bool is_nothrow_default_constructible_v
3629 = __is_nothrow_constructible(_Tp);
3630template <
typename _Tp>
3631 inline constexpr bool is_nothrow_copy_constructible_v
3632 = __is_nothrow_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3633template <
typename _Tp>
3634 inline constexpr bool is_nothrow_move_constructible_v
3635 = __is_nothrow_constructible(_Tp, __add_rval_ref_t<_Tp>);
3637template <
typename _Tp,
typename _Up>
3638 inline constexpr bool is_nothrow_assignable_v
3639 = __is_nothrow_assignable(_Tp, _Up);
3640template <
typename _Tp>
3641 inline constexpr bool is_nothrow_copy_assignable_v
3642 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>,
3643 __add_lval_ref_t<const _Tp>);
3644template <
typename _Tp>
3645 inline constexpr bool is_nothrow_move_assignable_v
3646 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3648template <
typename _Tp>
3649 inline constexpr bool is_nothrow_destructible_v =
3650 is_nothrow_destructible<_Tp>::value;
3652template <
typename _Tp>
3653 inline constexpr bool has_virtual_destructor_v
3654 = __has_virtual_destructor(_Tp);
3656template <
typename _Tp>
3657 inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
3659#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank)
3660template <
typename _Tp>
3661 inline constexpr size_t rank_v = __array_rank(_Tp);
3663template <
typename _Tp>
3664 inline constexpr size_t rank_v = 0;
3665template <
typename _Tp,
size_t _Size>
3666 inline constexpr size_t rank_v<_Tp[_Size]> = 1 + rank_v<_Tp>;
3667template <
typename _Tp>
3668 inline constexpr size_t rank_v<_Tp[]> = 1 + rank_v<_Tp>;
3671template <
typename _Tp,
unsigned _Idx = 0>
3672 inline constexpr size_t extent_v = 0;
3673template <
typename _Tp,
size_t _Size>
3674 inline constexpr size_t extent_v<_Tp[_Size], 0> = _Size;
3675template <
typename _Tp,
unsigned _Idx,
size_t _Size>
3676 inline constexpr size_t extent_v<_Tp[_Size], _Idx> = extent_v<_Tp, _Idx - 1>;
3677template <
typename _Tp>
3678 inline constexpr size_t extent_v<_Tp[], 0> = 0;
3679template <
typename _Tp,
unsigned _Idx>
3680 inline constexpr size_t extent_v<_Tp[], _Idx> = extent_v<_Tp, _Idx - 1>;
3682#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
3683template <
typename _Tp,
typename _Up>
3684 inline constexpr bool is_same_v = __is_same(_Tp, _Up);
3686template <
typename _Tp,
typename _Up>
3687 inline constexpr bool is_same_v =
false;
3688template <
typename _Tp>
3689 inline constexpr bool is_same_v<_Tp, _Tp> =
true;
3691template <
typename _Base,
typename _Derived>
3692 inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
3693#ifdef __cpp_lib_is_virtual_base_of
3694template <
typename _Base,
typename _Derived>
3695 inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived);
3697#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
3698template <
typename _From,
typename _To>
3699 inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
3701template <
typename _From,
typename _To>
3702 inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
3704template<
typename _Fn,
typename... _Args>
3705 inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
3706template<
typename _Fn,
typename... _Args>
3707 inline constexpr bool is_nothrow_invocable_v
3708 = is_nothrow_invocable<_Fn, _Args...>::value;
3709template<
typename _Ret,
typename _Fn,
typename... _Args>
3710 inline constexpr bool is_invocable_r_v
3711 = is_invocable_r<_Ret, _Fn, _Args...>::value;
3712template<
typename _Ret,
typename _Fn,
typename... _Args>
3713 inline constexpr bool is_nothrow_invocable_r_v
3714 = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
3718#ifdef __cpp_lib_has_unique_object_representations
3721 template<typename _Tp>
3722 struct has_unique_object_representations
3723 : bool_constant<__has_unique_object_representations(
3724 remove_cv_t<remove_all_extents_t<_Tp>>
3727 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3728 "template argument must be a complete class or an unbounded array");
3731# if __cpp_lib_type_trait_variable_templates
3733 template<typename _Tp>
3734 inline constexpr bool has_unique_object_representations_v
3735 = has_unique_object_representations<_Tp>::value;
3739#ifdef __cpp_lib_is_aggregate
3742 template<typename _Tp>
3744 : bool_constant<__is_aggregate(remove_cv_t<_Tp>)>
3747# if __cpp_lib_type_trait_variable_templates
3752 template<
typename _Tp>
3753 inline constexpr bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>);
3761#ifdef __cpp_lib_remove_cvref
3762# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
3763 template<
typename _Tp>
3765 {
using type = __remove_cvref(_Tp); };
3767 template<
typename _Tp>
3769 {
using type =
typename remove_cv<_Tp>::type; };
3771 template<
typename _Tp>
3772 struct remove_cvref<_Tp&>
3773 {
using type =
typename remove_cv<_Tp>::type; };
3775 template<
typename _Tp>
3776 struct remove_cvref<_Tp&&>
3777 {
using type =
typename remove_cv<_Tp>::type; };
3780 template<
typename _Tp>
3781 using remove_cvref_t =
typename remove_cvref<_Tp>::type;
3785#ifdef __cpp_lib_type_identity
3790 template<
typename _Tp>
3791 struct type_identity {
using type = _Tp; };
3793 template<
typename _Tp>
3794 using type_identity_t =
typename type_identity<_Tp>::type;
3798#ifdef __cpp_lib_unwrap_ref
3803 template<
typename _Tp>
3804 struct unwrap_reference {
using type = _Tp; };
3806 template<
typename _Tp>
3807 struct unwrap_reference<reference_wrapper<_Tp>> {
using type = _Tp&; };
3809 template<
typename _Tp>
3810 using unwrap_reference_t =
typename unwrap_reference<_Tp>::type;
3817 template<
typename _Tp>
3818 struct unwrap_ref_decay {
using type = unwrap_reference_t<decay_t<_Tp>>; };
3820 template<
typename _Tp>
3821 using unwrap_ref_decay_t =
typename unwrap_ref_decay<_Tp>::type;
3825#ifdef __cpp_lib_bounded_array_traits
3829# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_bounded_array)
3830 template<
typename _Tp>
3831 inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
3833 template<
typename _Tp>
3834 inline constexpr bool is_bounded_array_v =
false;
3836 template<
typename _Tp,
size_t _Size>
3837 inline constexpr bool is_bounded_array_v<_Tp[_Size]> =
true;
3843# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unbounded_array)
3844 template<
typename _Tp>
3845 inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp);
3847 template<
typename _Tp>
3848 inline constexpr bool is_unbounded_array_v =
false;
3850 template<
typename _Tp>
3851 inline constexpr bool is_unbounded_array_v<_Tp[]> =
true;
3856 template<
typename _Tp>
3857 struct is_bounded_array
3858 :
public bool_constant<is_bounded_array_v<_Tp>>
3863 template<
typename _Tp>
3864 struct is_unbounded_array
3865 :
public bool_constant<is_unbounded_array_v<_Tp>>
3869#if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L
3872 template<
typename _Tp,
typename _Up>
3874 : bool_constant<__is_layout_compatible(_Tp, _Up)>
3879 template<
typename _Tp,
typename _Up>
3881 = __is_layout_compatible(_Tp, _Up);
3883#if __has_builtin(__builtin_is_corresponding_member)
3884# ifndef __cpp_lib_is_layout_compatible
3885# error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set"
3889 template<
typename _S1,
typename _S2,
typename _M1,
typename _M2>
3892 {
return __builtin_is_corresponding_member(__m1, __m2); }
3896#if __has_builtin(__is_pointer_interconvertible_base_of) \
3897 && __cplusplus >= 202002L
3900 template<
typename _Base,
typename _Derived>
3902 : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)>
3907 template<
typename _Base,
typename _Derived>
3909 = __is_pointer_interconvertible_base_of(_Base, _Derived);
3911#if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
3912# ifndef __cpp_lib_is_pointer_interconvertible
3913# error "libstdc++ bug: is_pointer_interconvertible available but FTM is not set"
3919 template<
typename _Tp,
typename _Mem>
3922 {
return __builtin_is_pointer_interconvertible_with_class(__mp); }
3926#ifdef __cpp_lib_is_scoped_enum
3930# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
3931 template<
typename _Tp>
3932 struct is_scoped_enum
3933 : bool_constant<__is_scoped_enum(_Tp)>
3936 template<
typename _Tp>
3937 struct is_scoped_enum
3941 template<
typename _Tp>
3942 requires __is_enum(_Tp)
3943 &&
requires(remove_cv_t<_Tp> __t) { __t = __t; }
3944 struct is_scoped_enum<_Tp>
3945 : bool_constant<!requires(_Tp __t, void(*__f)(int)) { __f(__t); }>
3951# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
3952 template<
typename _Tp>
3953 inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
3955 template<
typename _Tp>
3956 inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
3960#ifdef __cpp_lib_reference_from_temporary
3965 template<typename _Tp, typename _Up>
3966 struct reference_constructs_from_temporary
3967 :
public bool_constant<__reference_constructs_from_temporary(_Tp, _Up)>
3969 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
3970 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3971 "template argument must be a complete class or an unbounded array");
3978 template<
typename _Tp,
typename _Up>
3979 struct reference_converts_from_temporary
3980 :
public bool_constant<__reference_converts_from_temporary(_Tp, _Up)>
3982 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
3983 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3984 "template argument must be a complete class or an unbounded array");
3989 template<
typename _Tp,
typename _Up>
3990 inline constexpr bool reference_constructs_from_temporary_v
3991 = reference_constructs_from_temporary<_Tp, _Up>::value;
3995 template<
typename _Tp,
typename _Up>
3996 inline constexpr bool reference_converts_from_temporary_v
3997 = reference_converts_from_temporary<_Tp, _Up>::value;
4000#ifdef __cpp_lib_is_constant_evaluated
4003 constexpr inline bool
4004 is_constant_evaluated() noexcept
4006#if __cpp_if_consteval >= 202106L
4007 if consteval {
return true; }
else {
return false; }
4009 return __builtin_is_constant_evaluated();
4014#if __cplusplus >= 202002L
4016 template<
typename _From,
typename _To>
4017 using __copy_cv =
typename __match_cv_qualifiers<_From, _To>::__type;
4019 template<
typename _Xp,
typename _Yp>
4021 =
decltype(
false ? declval<_Xp(&)()>()() :
declval<_Yp(&)()>()());
4023 template<
typename _Ap,
typename _Bp,
typename =
void>
4024 struct __common_ref_impl
4028 template<
typename _Ap,
typename _Bp>
4029 using __common_ref =
typename __common_ref_impl<_Ap, _Bp>::type;
4032 template<
typename _Xp,
typename _Yp>
4033 using __condres_cvref
4034 = __cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>;
4037 template<
typename _Xp,
typename _Yp>
4038 struct __common_ref_impl<_Xp&, _Yp&, __void_t<__condres_cvref<_Xp, _Yp>>>
4039 : enable_if<is_reference_v<__condres_cvref<_Xp, _Yp>>,
4040 __condres_cvref<_Xp, _Yp>>
4044 template<
typename _Xp,
typename _Yp>
4045 using __common_ref_C = remove_reference_t<__common_ref<_Xp&, _Yp&>>&&;
4048 template<
typename _Xp,
typename _Yp>
4049 struct __common_ref_impl<_Xp&&, _Yp&&,
4050 _Require<is_convertible<_Xp&&, __common_ref_C<_Xp, _Yp>>,
4051 is_convertible<_Yp&&, __common_ref_C<_Xp, _Yp>>>>
4052 {
using type = __common_ref_C<_Xp, _Yp>; };
4055 template<
typename _Xp,
typename _Yp>
4056 using __common_ref_D = __common_ref<const _Xp&, _Yp&>;
4059 template<
typename _Xp,
typename _Yp>
4060 struct __common_ref_impl<_Xp&&, _Yp&,
4061 _Require<is_convertible<_Xp&&, __common_ref_D<_Xp, _Yp>>>>
4062 {
using type = __common_ref_D<_Xp, _Yp>; };
4065 template<
typename _Xp,
typename _Yp>
4066 struct __common_ref_impl<_Xp&, _Yp&&>
4067 : __common_ref_impl<_Yp&&, _Xp&>
4071 template<
typename _Tp,
typename _Up,
4072 template<
typename>
class _TQual,
template<
typename>
class _UQual>
4073 struct basic_common_reference
4077 template<
typename _Tp>
4079 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>; };
4081 template<
typename _Tp>
4083 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&; };
4085 template<
typename _Tp>
4086 struct __xref<_Tp&&>
4087 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&&; };
4089 template<
typename _Tp1,
typename _Tp2>
4090 using __basic_common_ref
4091 =
typename basic_common_reference<remove_cvref_t<_Tp1>,
4092 remove_cvref_t<_Tp2>,
4093 __xref<_Tp1>::template __type,
4094 __xref<_Tp2>::template __type>::type;
4097 template<
typename... _Tp>
4098 struct common_reference;
4100 template<
typename... _Tp>
4105 struct common_reference<>
4109 template<
typename _Tp0>
4110 struct common_reference<_Tp0>
4111 {
using type = _Tp0; };
4114 template<
typename _Tp1,
typename _Tp2,
int _Bullet = 1,
typename =
void>
4115 struct __common_reference_impl
4116 : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1>
4120 template<
typename _Tp1,
typename _Tp2>
4121 struct common_reference<_Tp1, _Tp2>
4122 : __common_reference_impl<_Tp1, _Tp2>
4126 template<
typename _Tp1,
typename _Tp2>
4127 struct __common_reference_impl<_Tp1&, _Tp2&, 1,
4128 void_t<__common_ref<_Tp1&, _Tp2&>>>
4129 {
using type = __common_ref<_Tp1&, _Tp2&>; };
4131 template<
typename _Tp1,
typename _Tp2>
4132 struct __common_reference_impl<_Tp1&&, _Tp2&&, 1,
4133 void_t<__common_ref<_Tp1&&, _Tp2&&>>>
4134 {
using type = __common_ref<_Tp1&&, _Tp2&&>; };
4136 template<
typename _Tp1,
typename _Tp2>
4137 struct __common_reference_impl<_Tp1&, _Tp2&&, 1,
4138 void_t<__common_ref<_Tp1&, _Tp2&&>>>
4139 {
using type = __common_ref<_Tp1&, _Tp2&&>; };
4141 template<
typename _Tp1,
typename _Tp2>
4142 struct __common_reference_impl<_Tp1&&, _Tp2&, 1,
4143 void_t<__common_ref<_Tp1&&, _Tp2&>>>
4144 {
using type = __common_ref<_Tp1&&, _Tp2&>; };
4147 template<
typename _Tp1,
typename _Tp2>
4148 struct __common_reference_impl<_Tp1, _Tp2, 2,
4149 void_t<__basic_common_ref<_Tp1, _Tp2>>>
4150 {
using type = __basic_common_ref<_Tp1, _Tp2>; };
4153 template<
typename _Tp1,
typename _Tp2>
4154 struct __common_reference_impl<_Tp1, _Tp2, 3,
4155 void_t<__cond_res<_Tp1, _Tp2>>>
4156 {
using type = __cond_res<_Tp1, _Tp2>; };
4159 template<
typename _Tp1,
typename _Tp2>
4160 struct __common_reference_impl<_Tp1, _Tp2, 4,
4162 {
using type = common_type_t<_Tp1, _Tp2>; };
4165 template<
typename _Tp1,
typename _Tp2>
4166 struct __common_reference_impl<_Tp1, _Tp2, 5, void>
4170 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4171 struct common_reference<_Tp1, _Tp2, _Rest...>
4172 : __common_type_fold<common_reference<_Tp1, _Tp2>,
4173 __common_type_pack<_Rest...>>
4177 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4178 struct __common_type_fold<common_reference<_Tp1, _Tp2>,
4179 __common_type_pack<_Rest...>,
4181 :
public common_reference<common_reference_t<_Tp1, _Tp2>, _Rest...>
4189_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