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_common_reference
45#define __glibcxx_want_has_unique_object_representations
46#define __glibcxx_want_integral_constant_callable
47#define __glibcxx_want_is_aggregate
48#define __glibcxx_want_is_constant_evaluated
49#define __glibcxx_want_is_final
50#define __glibcxx_want_is_implicit_lifetime
51#define __glibcxx_want_is_invocable
52#define __glibcxx_want_is_layout_compatible
53#define __glibcxx_want_is_nothrow_convertible
54#define __glibcxx_want_is_null_pointer
55#define __glibcxx_want_is_pointer_interconvertible
56#define __glibcxx_want_is_scoped_enum
57#define __glibcxx_want_is_structural
58#define __glibcxx_want_is_swappable
59#define __glibcxx_want_is_virtual_base_of
60#define __glibcxx_want_logical_traits
61#define __glibcxx_want_reference_from_temporary
62#define __glibcxx_want_remove_cvref
63#define __glibcxx_want_result_of_sfinae
64#define __glibcxx_want_transformation_trait_aliases
65#define __glibcxx_want_type_identity
66#define __glibcxx_want_type_trait_variable_templates
67#define __glibcxx_want_unwrap_ref
68#define __glibcxx_want_void_t
69#define __glibcxx_want_within_lifetime
74namespace std _GLIBCXX_VISIBILITY(default)
76_GLIBCXX_BEGIN_NAMESPACE_VERSION
78 template<
typename _Tp>
95 template<
typename _Tp, _Tp __v>
98 static constexpr _Tp value = __v;
99 using value_type = _Tp;
101 constexpr operator value_type()
const noexcept {
return value; }
103#ifdef __cpp_lib_integral_constant_callable
104 constexpr value_type operator()()
const noexcept {
return value; }
108#if ! __cpp_inline_variables
109 template<
typename _Tp, _Tp __v>
110 constexpr _Tp integral_constant<_Tp, __v>::value;
125#ifdef __cpp_lib_bool_constant
129 using bool_constant = __bool_constant<__v>;
136 template<
bool,
typename _Tp =
void>
141 template<
typename _Tp>
143 {
using type = _Tp; };
146 template<
bool _Cond,
typename _Tp =
void>
147 using __enable_if_t =
typename enable_if<_Cond, _Tp>::type;
152 template<
typename _Tp,
typename>
157 struct __conditional<false>
159 template<
typename,
typename _Up>
164 template<
bool _Cond,
typename _If,
typename _Else>
165 using __conditional_t
166 =
typename __conditional<_Cond>::template type<_If, _Else>;
168#ifdef __cpp_lib_type_identity
173 template<
typename _Tp>
174 struct type_identity {
using type = _Tp; };
176 template<
typename _Tp>
177 using type_identity_t =
typename type_identity<_Tp>::type;
181 template <
typename _Tp>
182 using __type_identity = type_identity<_Tp>;
184 template<
typename _Tp>
185 using __type_identity_t =
typename type_identity<_Tp>::type;
189 template <
typename _Type>
190 struct __type_identity
191 {
using type = _Type; };
193 template<
typename _Tp>
194 using __type_identity_t =
typename __type_identity<_Tp>::type;
202 template<
typename _Tp,
typename...>
203 using __first_t = _Tp;
206 template<
typename... _Bn>
208 __enable_if_t<!bool(_Bn::value)>...>;
210 template<
typename... _Bn>
213 template<
typename... _Bn>
214 auto __and_fn(
int) -> __first_t<
true_type,
215 __enable_if_t<bool(_Bn::value)>...>;
217 template<
typename... _Bn>
224 template<
typename... _Bn>
226 : decltype(__detail::__or_fn<_Bn...>(0))
229 template<
typename... _Bn>
231 : decltype(__detail::__and_fn<_Bn...>(0))
234 template<
typename _Pp>
236 : __bool_constant<!bool(_Pp::value)>
240#ifdef __cpp_lib_logical_traits
243 template<
typename... _Bn>
244 inline constexpr bool __or_v = __or_<_Bn...>::value;
245 template<
typename... _Bn>
246 inline constexpr bool __and_v = __and_<_Bn...>::value;
250 template<
typename ,
typename _B1,
typename... _Bn>
251 struct __disjunction_impl
252 {
using type = _B1; };
254 template<
typename _B1,
typename _B2,
typename... _Bn>
255 struct __disjunction_impl<__enable_if_t<!bool(_B1::value)>, _B1, _B2, _Bn...>
256 {
using type =
typename __disjunction_impl<void, _B2, _Bn...>::type; };
258 template<
typename ,
typename _B1,
typename... _Bn>
259 struct __conjunction_impl
260 {
using type = _B1; };
262 template<
typename _B1,
typename _B2,
typename... _Bn>
263 struct __conjunction_impl<__enable_if_t<bool(_B1::value)>, _B1, _B2, _Bn...>
264 {
using type =
typename __conjunction_impl<void, _B2, _Bn...>::type; };
268 template<
typename... _Bn>
270 : __detail::__conjunction_impl<void, _Bn...>::type
278 template<
typename... _Bn>
280 : __detail::__disjunction_impl<void, _Bn...>::type
288 template<
typename _Pp>
296 template<
typename... _Bn>
297 inline constexpr bool conjunction_v = conjunction<_Bn...>::value;
299 template<
typename... _Bn>
300 inline constexpr bool disjunction_v = disjunction<_Bn...>::value;
302 template<
typename _Pp>
303 inline constexpr bool negation_v = negation<_Pp>::value;
318 struct __is_array_unknown_bounds;
323 template<
typename _Tp>
324 using __maybe_complete_object_type
325 = __and_<is_object<_Tp>, __not_<__is_array_unknown_bounds<_Tp>>>;
331 template<
typename _Tp,
332 typename = __enable_if_t<__maybe_complete_object_type<_Tp>::value>,
333 size_t =
sizeof(_Tp)>
335 __is_complete_or_unbounded(__type_identity<_Tp>)
340 template<
typename _TypeIdentity,
341 typename _NestedType =
typename _TypeIdentity::type>
342 constexpr typename __not_<__maybe_complete_object_type<_NestedType>>::type
343 __is_complete_or_unbounded(_TypeIdentity)
347 template<
typename _Tp>
348 using __remove_cv_t =
typename remove_cv<_Tp>::type;
354 template<
typename _Tp>
363 struct is_void<const void>
364 :
public true_type { };
371 struct is_void<const volatile void>
380 enum class _Integer_kind { _None, _Signed, _Unsigned };
383 struct __is_integral_helper
385 {
static constexpr auto _S_kind = _Integer_kind::_None; };
388 struct __is_integral_helper<bool>
390 {
static constexpr auto _S_kind = _Integer_kind::_None; };
393 struct __is_integral_helper<char>
395 {
static constexpr auto _S_kind = _Integer_kind::_None; };
398 struct __is_integral_helper<signed char>
400 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
403 struct __is_integral_helper<unsigned char>
405 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
411 struct __is_integral_helper<wchar_t>
413 {
static constexpr auto _S_kind = _Integer_kind::_None; };
415#ifdef _GLIBCXX_USE_CHAR8_T
417 struct __is_integral_helper<char8_t>
419 {
static constexpr auto _S_kind = _Integer_kind::_None; };
423 struct __is_integral_helper<char16_t>
425 {
static constexpr auto _S_kind = _Integer_kind::_None; };
428 struct __is_integral_helper<char32_t>
430 {
static constexpr auto _S_kind = _Integer_kind::_None; };
433 struct __is_integral_helper<short>
435 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
438 struct __is_integral_helper<unsigned short>
440 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
443 struct __is_integral_helper<int>
445 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
448 struct __is_integral_helper<unsigned int>
450 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
453 struct __is_integral_helper<long>
455 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
458 struct __is_integral_helper<unsigned long>
460 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
463 struct __is_integral_helper<long long>
465 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
468 struct __is_integral_helper<unsigned long long>
470 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
474#if defined(__GLIBCXX_TYPE_INT_N_0)
477 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
479 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
483 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
485 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
487#if defined(__GLIBCXX_TYPE_INT_N_1)
490 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
492 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
496 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
498 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
500#if defined(__GLIBCXX_TYPE_INT_N_2)
503 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
505 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
509 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
511 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
513#if defined(__GLIBCXX_TYPE_INT_N_3)
516 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
518 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
522 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
524 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
527#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
530 struct __is_integral_helper<__int128>
532 {
static constexpr auto _S_kind = _Integer_kind::_Signed; };
536 struct __is_integral_helper<unsigned __int128>
538 {
static constexpr auto _S_kind = _Integer_kind::_Unsigned; };
542 template<
typename _Tp>
543 using __is_signed_integer
544 = __bool_constant<__is_integral_helper<_Tp>::_S_kind
545 == _Integer_kind::_Signed>;
548 template<
typename _Tp>
549 using __is_unsigned_integer
550 = __bool_constant<__is_integral_helper<_Tp>::_S_kind
551 == _Integer_kind::_Unsigned>;
555 template<
typename _Tp>
556 using __is_signed_or_unsigned_integer
557 = __bool_constant<__is_integral_helper<_Tp>::_S_kind
558 != _Integer_kind::_None>;
563 template<
typename _Tp>
565 :
public __is_integral_helper<__remove_cv_t<_Tp>>::type
570 struct __is_floating_point_helper
574 struct __is_floating_point_helper<float>
575 :
public true_type { };
578 struct __is_floating_point_helper<double>
582 struct __is_floating_point_helper<long double>
585#ifdef __STDCPP_FLOAT16_T__
587 struct __is_floating_point_helper<_Float16>
591#ifdef __STDCPP_FLOAT32_T__
593 struct __is_floating_point_helper<_Float32>
597#ifdef __STDCPP_FLOAT64_T__
599 struct __is_floating_point_helper<_Float64>
603#ifdef __STDCPP_FLOAT128_T__
605 struct __is_floating_point_helper<_Float128>
609#ifdef __STDCPP_BFLOAT16_T__
611 struct __is_floating_point_helper<__gnu_cxx::__bfloat16_t>
615#ifdef _GLIBCXX_USE_FLOAT128
617 struct __is_floating_point_helper<__float128>
623 template<
typename _Tp>
625 :
public __is_floating_point_helper<__remove_cv_t<_Tp>>::type
629#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
630 template<
typename _Tp>
632 :
public __bool_constant<__is_array(_Tp)>
639 template<
typename _Tp, std::
size_t _Size>
640 struct is_array<_Tp[_Size]>
641 :
public true_type { };
643 template<
typename _Tp>
649#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
650 template<
typename _Tp>
652 :
public __bool_constant<__is_pointer(_Tp)>
655 template<
typename _Tp>
659 template<
typename _Tp>
660 struct is_pointer<_Tp*>
661 :
public true_type { };
663 template<
typename _Tp>
667 template<
typename _Tp>
671 template<
typename _Tp>
681 template<
typename _Tp>
690 template<
typename _Tp>
695#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
696 template<
typename _Tp>
698 :
public __bool_constant<__is_member_object_pointer(_Tp)>
701 template<
typename _Tp>
705 struct __is_member_object_pointer_helper
708 template<
typename _Tp,
typename _Cp>
709 struct __is_member_object_pointer_helper<_Tp _Cp::*>
710 :
public __not_<is_function<_Tp>>::type { };
713 template<
typename _Tp>
715 :
public __is_member_object_pointer_helper<__remove_cv_t<_Tp>>::type
719#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
721 template<
typename _Tp>
723 :
public __bool_constant<__is_member_function_pointer(_Tp)>
726 template<
typename _Tp>
730 struct __is_member_function_pointer_helper
733 template<
typename _Tp,
typename _Cp>
734 struct __is_member_function_pointer_helper<_Tp _Cp::*>
735 :
public is_function<_Tp>::type { };
738 template<
typename _Tp>
740 :
public __is_member_function_pointer_helper<__remove_cv_t<_Tp>>::type
745 template<
typename _Tp>
747 :
public __bool_constant<__is_enum(_Tp)>
751 template<
typename _Tp>
753 :
public __bool_constant<__is_union(_Tp)>
757 template<
typename _Tp>
759 :
public __bool_constant<__is_class(_Tp)>
763#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
764 template<
typename _Tp>
766 :
public __bool_constant<__is_function(_Tp)>
769 template<
typename _Tp>
771 :
public __bool_constant<!is_const<const _Tp>::value> { };
773 template<
typename _Tp>
774 struct is_function<_Tp&>
775 :
public false_type { };
777 template<
typename _Tp>
782#if __cpp_impl_reflection >= 202506L
784 template<typename _Tp>
789 struct is_reflection<decltype(^^int)>
793 struct is_reflection<const decltype(^^int)>
797 struct is_reflection<volatile decltype(^^int)>
801 struct is_reflection<const volatile decltype(^^int)>
805#ifdef __cpp_lib_is_null_pointer
807 template<typename _Tp>
808 struct is_null_pointer
812 struct is_null_pointer<std::nullptr_t>
816 struct is_null_pointer<const std::nullptr_t>
820 struct is_null_pointer<volatile std::nullptr_t>
824 struct is_null_pointer<const volatile std::nullptr_t>
829 template<
typename _Tp>
830 struct __is_nullptr_t
831 :
public is_null_pointer<_Tp>
832 { } _GLIBCXX_DEPRECATED_SUGGEST(
"std::is_null_pointer");
838#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
839 template<
typename _Tp>
841 :
public __bool_constant<__is_reference(_Tp)>
844 template<
typename _Tp>
849 template<
typename _Tp>
850 struct is_reference<_Tp&>
854 template<
typename _Tp>
861 template<
typename _Tp>
863 :
public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
867 template<
typename _Tp>
869 :
public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
871#if __cpp_impl_reflection >= 202506L
878#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
879 template<
typename _Tp>
881 :
public __bool_constant<__is_object(_Tp)>
884 template<
typename _Tp>
886 :
public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
892 struct is_member_pointer;
895 template<
typename _Tp>
897 :
public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
898 is_member_pointer<_Tp>, is_null_pointer<_Tp>
899#if __cpp_impl_reflection >= 202506L
906 template<
typename _Tp>
908 :
public __bool_constant<!is_fundamental<_Tp>::value> { };
911#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
912 template<
typename _Tp>
914 :
public __bool_constant<__is_member_pointer(_Tp)>
918 template<
typename _Tp>
919 struct __is_member_pointer_helper
922 template<
typename _Tp,
typename _Cp>
923 struct __is_member_pointer_helper<_Tp _Cp::*>
924 :
public true_type { };
927 template<
typename _Tp>
929 :
public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type
933 template<
typename,
typename>
937 template<
typename _Tp,
typename... _Types>
938 using __is_one_of = __or_<is_same<_Tp, _Types>...>;
941 template<
typename...>
using __void_t = void;
947#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
948 template<
typename _Tp>
950 :
public __bool_constant<__is_const(_Tp)>
957 template<
typename _Tp>
958 struct is_const<_Tp const>
959 :
public true_type { };
963#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
964 template<
typename _Tp>
966 :
public __bool_constant<__is_volatile(_Tp)>
973 template<
typename _Tp>
974 struct is_volatile<_Tp volatile>
975 :
public true_type { };
985 template<
typename _Tp>
987 _GLIBCXX26_DEPRECATED_SUGGEST(
"is_trivially_default_constructible && is_trivially_copyable")
989 : public __bool_constant<__is_trivial(_Tp)>
991 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
992 "template argument must be a complete class or an unbounded array");
996 template<
typename _Tp>
998 :
public __bool_constant<__is_trivially_copyable(_Tp)>
1000 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1001 "template argument must be a complete class or an unbounded array");
1005 template<
typename _Tp>
1007 :
public __bool_constant<__is_standard_layout(_Tp)>
1009 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1010 "template argument must be a complete class or an unbounded array");
1018 template<
typename _Tp>
1020 _GLIBCXX20_DEPRECATED_SUGGEST(
"is_standard_layout && is_trivial")
1022 : public __bool_constant<__is_pod(_Tp)>
1024 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1025 "template argument must be a complete class or an unbounded array");
1032 template<
typename _Tp>
1034 _GLIBCXX17_DEPRECATED
1036 :
public __bool_constant<__is_literal_type(_Tp)>
1038 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1039 "template argument must be a complete class or an unbounded array");
1043 template<
typename _Tp>
1045 :
public __bool_constant<__is_empty(_Tp)>
1049 template<
typename _Tp>
1051 :
public __bool_constant<__is_polymorphic(_Tp)>
1054#ifdef __cpp_lib_is_final
1057 template<typename _Tp>
1059 :
public __bool_constant<__is_final(_Tp)>
1064 template<
typename _Tp>
1066 :
public __bool_constant<__is_abstract(_Tp)>
1070 template<
typename _Tp,
1072 struct __is_signed_helper
1075 template<
typename _Tp>
1076 struct __is_signed_helper<_Tp, true>
1077 :
public __bool_constant<_Tp(-1) < _Tp(0)>
1082 template<typename _Tp>
1084 : public __is_signed_helper<_Tp>::type
1088 template<typename _Tp>
1090 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
1094 template<typename _Tp, typename _Up = _Tp&&>
1098 template<typename _Tp>
1103 template<typename _Tp>
1104 auto declval() noexcept -> decltype(__declval<_Tp>(0));
1110 template<typename _Tp>
1111 struct __is_array_known_bounds
1115 template<
typename _Tp,
size_t _Size>
1116 struct __is_array_known_bounds<_Tp[_Size]>
1120 template<
typename _Tp>
1121 struct __is_array_unknown_bounds
1125 template<
typename _Tp>
1126 struct __is_array_unknown_bounds<_Tp[]>
1133#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_destructible)
1135 template<
typename _Tp>
1137 :
public __bool_constant<__is_destructible(_Tp)>
1147 struct __do_is_destructible_impl
1149 template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
1156 template<
typename _Tp>
1157 struct __is_destructible_impl
1158 :
public __do_is_destructible_impl
1160 using type =
decltype(__test<_Tp>(0));
1163 template<
typename _Tp,
1164 bool = __or_<is_void<_Tp>,
1165 __is_array_unknown_bounds<_Tp>,
1168 struct __is_destructible_safe;
1170 template<
typename _Tp>
1171 struct __is_destructible_safe<_Tp, false, false>
1172 :
public __is_destructible_impl<typename
1173 remove_all_extents<_Tp>::type>::type
1176 template<
typename _Tp>
1177 struct __is_destructible_safe<_Tp, true, false>
1180 template<
typename _Tp>
1181 struct __is_destructible_safe<_Tp, false, true>
1186 template<
typename _Tp>
1188 :
public __is_destructible_safe<_Tp>::type
1190 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1191 "template argument must be a complete class or an unbounded array");
1195#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_destructible)
1197 template<
typename _Tp>
1199 :
public __bool_constant<__is_nothrow_destructible(_Tp)>
1208 struct __do_is_nt_destructible_impl
1210 template<
typename _Tp>
1211 static __bool_constant<noexcept(declval<_Tp&>().~_Tp())>
1218 template<
typename _Tp>
1219 struct __is_nt_destructible_impl
1220 :
public __do_is_nt_destructible_impl
1222 using type =
decltype(__test<_Tp>(0));
1225 template<
typename _Tp,
1226 bool = __or_<is_void<_Tp>,
1227 __is_array_unknown_bounds<_Tp>,
1230 struct __is_nt_destructible_safe;
1232 template<
typename _Tp>
1233 struct __is_nt_destructible_safe<_Tp, false, false>
1234 :
public __is_nt_destructible_impl<typename
1235 remove_all_extents<_Tp>::type>::type
1238 template<
typename _Tp>
1239 struct __is_nt_destructible_safe<_Tp, true, false>
1242 template<
typename _Tp>
1243 struct __is_nt_destructible_safe<_Tp, false, true>
1248 template<
typename _Tp>
1250 :
public __is_nt_destructible_safe<_Tp>::type
1252 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1253 "template argument must be a complete class or an unbounded array");
1258 template<
typename _Tp,
typename... _Args>
1259 using __is_constructible_impl
1260 = __bool_constant<__is_constructible(_Tp, _Args...)>;
1264 template<
typename _Tp,
typename... _Args>
1266 :
public __is_constructible_impl<_Tp, _Args...>
1268 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1269 "template argument must be a complete class or an unbounded array");
1273 template<
typename _Tp>
1275 :
public __is_constructible_impl<_Tp>
1277 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1278 "template argument must be a complete class or an unbounded array");
1282#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference)
1283 template<
typename _Tp>
1284 using __add_lval_ref_t = __add_lvalue_reference(_Tp);
1286 template<
typename _Tp,
typename =
void>
1287 struct __add_lvalue_reference_helper
1288 {
using type = _Tp; };
1290 template<
typename _Tp>
1291 struct __add_lvalue_reference_helper<_Tp, __void_t<_Tp&>>
1292 {
using type = _Tp&; };
1294 template<
typename _Tp>
1295 using __add_lval_ref_t =
typename __add_lvalue_reference_helper<_Tp>::type;
1300 template<
typename _Tp>
1302 :
public __is_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1304 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1305 "template argument must be a complete class or an unbounded array");
1309#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_rvalue_reference)
1310 template<
typename _Tp>
1311 using __add_rval_ref_t = __add_rvalue_reference(_Tp);
1313 template<
typename _Tp,
typename =
void>
1314 struct __add_rvalue_reference_helper
1315 {
using type = _Tp; };
1317 template<
typename _Tp>
1318 struct __add_rvalue_reference_helper<_Tp, __void_t<_Tp&&>>
1319 {
using type = _Tp&&; };
1321 template<
typename _Tp>
1322 using __add_rval_ref_t =
typename __add_rvalue_reference_helper<_Tp>::type;
1327 template<
typename _Tp>
1329 :
public __is_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1331 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1332 "template argument must be a complete class or an unbounded array");
1336 template<
typename _Tp,
typename... _Args>
1337 using __is_nothrow_constructible_impl
1338 = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;
1342 template<
typename _Tp,
typename... _Args>
1344 :
public __is_nothrow_constructible_impl<_Tp, _Args...>
1346 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1347 "template argument must be a complete class or an unbounded array");
1351 template<
typename _Tp>
1353 :
public __is_nothrow_constructible_impl<_Tp>
1355 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1356 "template argument must be a complete class or an unbounded array");
1360 template<
typename _Tp>
1362 :
public __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1364 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1365 "template argument must be a complete class or an unbounded array");
1369 template<
typename _Tp>
1371 :
public __is_nothrow_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1373 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1374 "template argument must be a complete class or an unbounded array");
1378 template<
typename _Tp,
typename _Up>
1379 using __is_assignable_impl = __bool_constant<__is_assignable(_Tp, _Up)>;
1383 template<
typename _Tp,
typename _Up>
1385 :
public __is_assignable_impl<_Tp, _Up>
1387 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1388 "template argument must be a complete class or an unbounded array");
1392 template<
typename _Tp>
1394 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>,
1395 __add_lval_ref_t<const _Tp>>
1397 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1398 "template argument must be a complete class or an unbounded array");
1402 template<
typename _Tp>
1404 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>, __add_rval_ref_t<_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,
typename _Up>
1412 using __is_nothrow_assignable_impl
1413 = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>;
1417 template<
typename _Tp,
typename _Up>
1419 :
public __is_nothrow_assignable_impl<_Tp, _Up>
1421 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1422 "template argument must be a complete class or an unbounded array");
1426 template<
typename _Tp>
1428 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1429 __add_lval_ref_t<const _Tp>>
1431 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1432 "template argument must be a complete class or an unbounded array");
1436 template<
typename _Tp>
1438 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1439 __add_rval_ref_t<_Tp>>
1441 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1442 "template argument must be a complete class or an unbounded array");
1446 template<
typename _Tp,
typename... _Args>
1447 using __is_trivially_constructible_impl
1448 = __bool_constant<__is_trivially_constructible(_Tp, _Args...)>;
1452 template<
typename _Tp,
typename... _Args>
1454 :
public __is_trivially_constructible_impl<_Tp, _Args...>
1456 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1457 "template argument must be a complete class or an unbounded array");
1461 template<
typename _Tp>
1463 :
public __is_trivially_constructible_impl<_Tp>
1465 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1466 "template argument must be a complete class or an unbounded array");
1469#if __cpp_variable_templates && __cpp_concepts
1470 template<
typename _Tp>
1471 constexpr bool __is_implicitly_default_constructible_v
1472 =
requires (void(&__f)(_Tp)) { __f({}); };
1474 template<
typename _Tp>
1475 struct __is_implicitly_default_constructible
1476 : __bool_constant<__is_implicitly_default_constructible_v<_Tp>>
1479 struct __do_is_implicitly_default_constructible_impl
1481 template <
typename _Tp>
1482 static void __helper(
const _Tp&);
1484 template <
typename _Tp>
1486 decltype(__helper<const _Tp&>({}))* = 0);
1491 template<
typename _Tp>
1492 struct __is_implicitly_default_constructible_impl
1493 :
public __do_is_implicitly_default_constructible_impl
1498 template<
typename _Tp>
1499 struct __is_implicitly_default_constructible_safe
1500 :
public __is_implicitly_default_constructible_impl<_Tp>::type
1503 template <
typename _Tp>
1504 struct __is_implicitly_default_constructible
1505 :
public __and_<__is_constructible_impl<_Tp>,
1506 __is_implicitly_default_constructible_safe<_Tp>>::type
1511 template<
typename _Tp>
1513 :
public __is_trivially_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1515 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1516 "template argument must be a complete class or an unbounded array");
1520 template<
typename _Tp>
1522 :
public __is_trivially_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1524 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1525 "template argument must be a complete class or an unbounded array");
1529 template<
typename _Tp,
typename _Up>
1530 using __is_trivially_assignable_impl
1531 = __bool_constant<__is_trivially_assignable(_Tp, _Up)>;
1535 template<
typename _Tp,
typename _Up>
1537 :
public __is_trivially_assignable_impl<_Tp, _Up>
1539 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1540 "template argument must be a complete class or an unbounded array");
1544 template<
typename _Tp>
1546 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1547 __add_lval_ref_t<const _Tp>>
1549 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1550 "template argument must be a complete class or an unbounded array");
1554 template<
typename _Tp>
1556 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1557 __add_rval_ref_t<_Tp>>
1559 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1560 "template argument must be a complete class or an unbounded array");
1563#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_trivially_destructible)
1565 template<
typename _Tp>
1567 :
public __bool_constant<__is_trivially_destructible(_Tp)>
1571 template<
typename _Tp>
1573 :
public __and_<__is_destructible_safe<_Tp>,
1574 __bool_constant<__has_trivial_destructor(_Tp)>>::type
1576 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1577 "template argument must be a complete class or an unbounded array");
1582 template<
typename _Tp>
1584 :
public __bool_constant<__has_virtual_destructor(_Tp)>
1586 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1587 "template argument must be a complete class or an unbounded array");
1594 template<
typename _Tp>
1598 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1599 "template argument must be a complete class or an unbounded array");
1603#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) \
1604 && (!defined(__clang__) || __clang_major__ >= 20)
1605 template<
typename _Tp>
1613 template<
typename _Tp, std::
size_t _Size>
1614 struct rank<_Tp[_Size]>
1615 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1617 template<
typename _Tp>
1623 template<
typename,
unsigned _U
int = 0>
1627 template<
typename _Tp,
size_t _Size>
1628 struct extent<_Tp[_Size], 0>
1631 template<
typename _Tp,
unsigned _U
int,
size_t _Size>
1632 struct extent<_Tp[_Size], _Uint>
1633 :
public extent<_Tp, _Uint - 1>::type { };
1635 template<
typename _Tp>
1639 template<
typename _Tp,
unsigned _U
int>
1640 struct extent<_Tp[], _Uint>
1641 :
public extent<_Tp, _Uint - 1>::type { };
1647#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
1648 template<
typename _Tp,
typename _Up>
1650 :
public __bool_constant<__is_same(_Tp, _Up)>
1653 template<
typename _Tp,
typename _Up>
1658 template<
typename _Tp>
1659 struct is_same<_Tp, _Tp>
1665 template<
typename _Base,
typename _Derived>
1667 :
public __bool_constant<__is_base_of(_Base, _Derived)>
1670#ifdef __cpp_lib_is_virtual_base_of
1673 template<typename _Base, typename _Derived>
1674 struct is_virtual_base_of
1675 :
public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)>
1679#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
1680 template<
typename _From,
typename _To>
1681 struct is_convertible
1682 :
public __bool_constant<__is_convertible(_From, _To)>
1685 template<
typename _From,
typename _To,
1688 struct __is_convertible_helper
1690 using type =
typename is_void<_To>::type;
1693#pragma GCC diagnostic push
1694#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1695 template<
typename _From,
typename _To>
1696 class __is_convertible_helper<_From, _To, false>
1698 template<
typename _To1>
1699 static void __test_aux(_To1)
noexcept;
1701 template<
typename _From1,
typename _To1,
1706 template<
typename,
typename>
1711 using type =
decltype(__test<_From, _To>(0));
1713#pragma GCC diagnostic pop
1716 template<
typename _From,
typename _To>
1717 struct is_convertible
1718 :
public __is_convertible_helper<_From, _To>::type
1723 template<
typename _ToElementType,
typename _FromElementType>
1724 using __is_array_convertible
1725 = is_convertible<_FromElementType(*)[], _ToElementType(*)[]>;
1727#ifdef __cpp_lib_is_nothrow_convertible
1729#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
1731 template<
typename _From,
typename _To>
1732 inline constexpr bool is_nothrow_convertible_v
1733 = __is_nothrow_convertible(_From, _To);
1736 template<
typename _From,
typename _To>
1737 struct is_nothrow_convertible
1738 :
public bool_constant<is_nothrow_convertible_v<_From, _To>>
1741 template<
typename _From,
typename _To,
1744 struct __is_nt_convertible_helper
1748#pragma GCC diagnostic push
1749#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1750 template<
typename _From,
typename _To>
1751 class __is_nt_convertible_helper<_From, _To, false>
1753 template<
typename _To1>
1754 static void __test_aux(_To1)
noexcept;
1756 template<
typename _From1,
typename _To1>
1761 template<
typename,
typename>
1766 using type =
decltype(__test<_From, _To>(0));
1768#pragma GCC diagnostic pop
1771 template<
typename _From,
typename _To>
1772 struct is_nothrow_convertible
1773 :
public __is_nt_convertible_helper<_From, _To>::type
1777 template<
typename _From,
typename _To>
1778 inline constexpr bool is_nothrow_convertible_v
1779 = is_nothrow_convertible<_From, _To>::value;
1783#pragma GCC diagnostic push
1784#pragma GCC diagnostic ignored "-Wc++14-extensions"
1785 template<
typename _Tp,
typename... _Args>
1786 struct __is_nothrow_new_constructible_impl
1788 noexcept(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))
1792 template<
typename _Tp,
typename... _Args>
1793 _GLIBCXX17_INLINE
constexpr bool __is_nothrow_new_constructible
1795 __is_nothrow_new_constructible_impl<_Tp, _Args...>>::value;
1796#pragma GCC diagnostic pop
1801 template<
typename _Tp>
1803 {
using type = _Tp; };
1805 template<
typename _Tp>
1807 {
using type = _Tp; };
1810 template<
typename _Tp>
1812 {
using type = _Tp; };
1814 template<
typename _Tp>
1816 {
using type = _Tp; };
1819#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
1820 template<
typename _Tp>
1822 {
using type = __remove_cv(_Tp); };
1824 template<
typename _Tp>
1826 {
using type = _Tp; };
1828 template<
typename _Tp>
1829 struct remove_cv<const _Tp>
1830 {
using type = _Tp; };
1832 template<
typename _Tp>
1834 {
using type = _Tp; };
1836 template<
typename _Tp>
1838 {
using type = _Tp; };
1842 template<
typename _Tp>
1844 {
using type = _Tp
const; };
1847 template<
typename _Tp>
1849 {
using type = _Tp
volatile; };
1852 template<
typename _Tp>
1854 {
using type = _Tp
const volatile; };
1856#ifdef __cpp_lib_transformation_trait_aliases
1858 template<typename _Tp>
1859 using remove_const_t =
typename remove_const<_Tp>::type;
1862 template<
typename _Tp>
1863 using remove_volatile_t =
typename remove_volatile<_Tp>::type;
1866 template<
typename _Tp>
1867 using remove_cv_t =
typename remove_cv<_Tp>::type;
1870 template<
typename _Tp>
1871 using add_const_t =
typename add_const<_Tp>::type;
1874 template<
typename _Tp>
1875 using add_volatile_t =
typename add_volatile<_Tp>::type;
1878 template<
typename _Tp>
1879 using add_cv_t =
typename add_cv<_Tp>::type;
1885#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
1886 template<
typename _Tp>
1888 {
using type = __remove_reference(_Tp); };
1890 template<
typename _Tp>
1892 {
using type = _Tp; };
1894 template<
typename _Tp>
1895 struct remove_reference<_Tp&>
1896 {
using type = _Tp; };
1898 template<
typename _Tp>
1900 {
using type = _Tp; };
1904 template<
typename _Tp>
1906 {
using type = __add_lval_ref_t<_Tp>; };
1909 template<
typename _Tp>
1911 {
using type = __add_rval_ref_t<_Tp>; };
1913#if __cplusplus > 201103L
1915 template<
typename _Tp>
1919 template<
typename _Tp>
1923 template<
typename _Tp>
1932 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1933 struct __cv_selector;
1935 template<
typename _Unqualified>
1936 struct __cv_selector<_Unqualified, false, false>
1937 {
using __type = _Unqualified; };
1939 template<
typename _Unqualified>
1940 struct __cv_selector<_Unqualified, false, true>
1941 {
using __type =
volatile _Unqualified; };
1943 template<
typename _Unqualified>
1944 struct __cv_selector<_Unqualified, true, false>
1945 {
using __type =
const _Unqualified; };
1947 template<
typename _Unqualified>
1948 struct __cv_selector<_Unqualified, true, true>
1949 {
using __type =
const volatile _Unqualified; };
1951 template<
typename _Qualified,
typename _Unqualified,
1954 class __match_cv_qualifiers
1956 using __match = __cv_selector<_Unqualified, _IsConst, _IsVol>;
1959 using __type =
typename __match::__type;
1963 template<
typename _Tp>
1964 struct __make_unsigned
1965 {
using __type = _Tp; };
1968 struct __make_unsigned<char>
1969 {
using __type =
unsigned char; };
1972 struct __make_unsigned<signed char>
1973 {
using __type =
unsigned char; };
1976 struct __make_unsigned<short>
1977 {
using __type =
unsigned short; };
1980 struct __make_unsigned<int>
1981 {
using __type =
unsigned int; };
1984 struct __make_unsigned<long>
1985 {
using __type =
unsigned long; };
1988 struct __make_unsigned<long long>
1989 {
using __type =
unsigned long long; };
1991#if defined(__GLIBCXX_TYPE_INT_N_0)
1994 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1995 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_0; };
1997#if defined(__GLIBCXX_TYPE_INT_N_1)
2000 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
2001 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_1; };
2003#if defined(__GLIBCXX_TYPE_INT_N_2)
2006 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
2007 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_2; };
2009#if defined(__GLIBCXX_TYPE_INT_N_3)
2012 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
2013 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_3; };
2015#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
2018 struct __make_unsigned<__int128>
2019 {
using __type =
unsigned __int128; };
2023 template<
typename _Tp,
2025 bool _IsEnum = __is_enum(_Tp)>
2026 class __make_unsigned_selector;
2028 template<
typename _Tp>
2029 class __make_unsigned_selector<_Tp, true, false>
2031 using __unsigned_type
2032 =
typename __make_unsigned<__remove_cv_t<_Tp>>::__type;
2036 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
2039 class __make_unsigned_selector_base
2042 template<
typename...>
struct _List { };
2044 template<
typename _Tp,
typename... _Up>
2045 struct _List<_Tp, _Up...> : _List<_Up...>
2046 {
static constexpr size_t __size =
sizeof(_Tp); };
2048 template<
size_t _Sz,
typename _Tp,
bool = (_Sz <= _Tp::__size)>
2051 template<
size_t _Sz,
typename _U
int,
typename... _UInts>
2052 struct __select<_Sz, _List<_Uint, _UInts...>,
true>
2053 {
using __type = _Uint; };
2055 template<
size_t _Sz,
typename _Uint,
typename... _UInts>
2056 struct __select<_Sz, _List<_Uint, _UInts...>, false>
2057 : __select<_Sz, _List<_UInts...>>
2062 template<
typename _Tp>
2063 class __make_unsigned_selector<_Tp, false, true>
2064 : __make_unsigned_selector_base
2068 using _UInts = _List<
unsigned char,
unsigned short,
unsigned int,
2069 unsigned long,
unsigned long long
2070#ifdef __SIZEOF_INT128__
2075 using __unsigned_type =
typename __select<
sizeof(_Tp), _UInts>::__type;
2079 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
2087 struct __make_unsigned<wchar_t>
2090 =
typename __make_unsigned_selector<wchar_t, false, true>::__type;
2093#ifdef _GLIBCXX_USE_CHAR8_T
2095 struct __make_unsigned<char8_t>
2098 =
typename __make_unsigned_selector<char8_t, false, true>::__type;
2103 struct __make_unsigned<char16_t>
2106 =
typename __make_unsigned_selector<char16_t, false, true>::__type;
2110 struct __make_unsigned<char32_t>
2113 =
typename __make_unsigned_selector<char32_t, false, true>::__type;
2121 template<
typename _Tp>
2123 {
using type =
typename __make_unsigned_selector<_Tp>::__type; };
2134 template<
typename _Tp>
2135 struct __make_signed
2136 {
using __type = _Tp; };
2139 struct __make_signed<char>
2140 {
using __type =
signed char; };
2143 struct __make_signed<unsigned char>
2144 {
using __type =
signed char; };
2147 struct __make_signed<unsigned short>
2148 {
using __type =
signed short; };
2151 struct __make_signed<unsigned int>
2152 {
using __type =
signed int; };
2155 struct __make_signed<unsigned long>
2156 {
using __type =
signed long; };
2159 struct __make_signed<unsigned long long>
2160 {
using __type =
signed long long; };
2162#if defined(__GLIBCXX_TYPE_INT_N_0)
2165 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
2166 {
using __type = __GLIBCXX_TYPE_INT_N_0; };
2168#if defined(__GLIBCXX_TYPE_INT_N_1)
2171 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
2172 {
using __type = __GLIBCXX_TYPE_INT_N_1; };
2174#if defined(__GLIBCXX_TYPE_INT_N_2)
2177 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
2178 {
using __type = __GLIBCXX_TYPE_INT_N_2; };
2180#if defined(__GLIBCXX_TYPE_INT_N_3)
2183 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
2184 {
using __type = __GLIBCXX_TYPE_INT_N_3; };
2186#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
2189 struct __make_signed<unsigned __int128>
2190 {
using __type = __int128; };
2194 template<
typename _Tp,
2196 bool _IsEnum = __is_enum(_Tp)>
2197 class __make_signed_selector;
2199 template<
typename _Tp>
2200 class __make_signed_selector<_Tp, true, false>
2203 =
typename __make_signed<__remove_cv_t<_Tp>>::__type;
2207 =
typename __match_cv_qualifiers<_Tp, __signed_type>::__type;
2211 template<
typename _Tp>
2212 class __make_signed_selector<_Tp, false, true>
2214 using __unsigned_type =
typename __make_unsigned_selector<_Tp>::__type;
2217 using __type =
typename __make_signed_selector<__unsigned_type>::__type;
2225 struct __make_signed<wchar_t>
2228 =
typename __make_signed_selector<wchar_t, false, true>::__type;
2231#if defined(_GLIBCXX_USE_CHAR8_T)
2233 struct __make_signed<char8_t>
2236 =
typename __make_signed_selector<char8_t, false, true>::__type;
2241 struct __make_signed<char16_t>
2244 =
typename __make_signed_selector<char16_t, false, true>::__type;
2248 struct __make_signed<char32_t>
2251 =
typename __make_signed_selector<char32_t, false, true>::__type;
2259 template<
typename _Tp>
2261 {
using type =
typename __make_signed_selector<_Tp>::__type; };
2267 template<>
struct make_signed<bool const volatile>;
2269#if __cplusplus > 201103L
2271 template<
typename _Tp>
2275 template<
typename _Tp>
2282#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_extent)
2283 template<
typename _Tp>
2285 {
using type = __remove_extent(_Tp); };
2287 template<
typename _Tp>
2289 {
using type = _Tp; };
2291 template<
typename _Tp, std::
size_t _Size>
2292 struct remove_extent<_Tp[_Size]>
2293 {
using type = _Tp; };
2295 template<
typename _Tp>
2297 {
using type = _Tp; };
2301#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
2302 template<
typename _Tp>
2304 {
using type = __remove_all_extents(_Tp); };
2306 template<
typename _Tp>
2308 {
using type = _Tp; };
2310 template<
typename _Tp, std::
size_t _Size>
2311 struct remove_all_extents<_Tp[_Size]>
2312 {
using type =
typename remove_all_extents<_Tp>::type; };
2314 template<
typename _Tp>
2316 {
using type =
typename remove_all_extents<_Tp>::type; };
2319#if __cplusplus > 201103L
2321 template<
typename _Tp>
2325 template<
typename _Tp>
2332#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_pointer)
2333 template<
typename _Tp>
2335 {
using type = __remove_pointer(_Tp); };
2337 template<
typename _Tp,
typename>
2338 struct __remove_pointer_helper
2339 {
using type = _Tp; };
2341 template<
typename _Tp,
typename _Up>
2342 struct __remove_pointer_helper<_Tp, _Up*>
2343 {
using type = _Up; };
2345 template<
typename _Tp>
2347 :
public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>>
2352#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer)
2353 template<
typename _Tp>
2355 {
using type = __add_pointer(_Tp); };
2357 template<
typename _Tp,
typename =
void>
2358 struct __add_pointer_helper
2359 {
using type = _Tp; };
2361 template<
typename _Tp>
2362 struct __add_pointer_helper<_Tp, __void_t<_Tp*>>
2363 {
using type = _Tp*; };
2365 template<
typename _Tp>
2367 :
public __add_pointer_helper<_Tp>
2370 template<
typename _Tp>
2372 {
using type = _Tp*; };
2374 template<
typename _Tp>
2376 {
using type = _Tp*; };
2379#if __cplusplus > 201103L
2381 template<
typename _Tp>
2385 template<
typename _Tp>
2392 struct __attribute__((__aligned__)) __aligned_storage_max_align_t
2396 __aligned_storage_default_alignment([[__maybe_unused__]]
size_t __len)
2398#if _GLIBCXX_INLINE_VERSION
2400 = integral_constant<size_t,
alignof(__aligned_storage_max_align_t)>;
2402 return __len > (_Max_align::value / 2)
2404#
if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_clzg)
2405 : 1 << (__SIZE_WIDTH__ - __builtin_clzg(__len - 1u));
2407 : 1 << (__LLONG_WIDTH__ - __builtin_clzll(__len - 1ull));
2412 return alignof(__aligned_storage_max_align_t);
2448 template<
size_t _Len,
2449 size_t _Align = __aligned_storage_default_alignment(_Len)>
2451 _GLIBCXX23_DEPRECATED
2456 alignas(_Align)
unsigned char __data[_Len];
2460 template <
typename... _Types>
2461 struct __strictest_alignment
2463 static const size_t _S_alignment = 0;
2464 static const size_t _S_size = 0;
2467 template <
typename _Tp,
typename... _Types>
2468 struct __strictest_alignment<_Tp, _Types...>
2470 static const size_t _S_alignment =
2471 alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
2472 ?
alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
2473 static const size_t _S_size =
2474 sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
2475 ?
sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
2478#pragma GCC diagnostic push
2479#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2493 template <
size_t _Len,
typename... _Types>
2495 _GLIBCXX23_DEPRECATED
2499 static_assert(
sizeof...(_Types) != 0,
"At least one type is required");
2501 using __strictest = __strictest_alignment<_Types...>;
2502 static const size_t _S_len = _Len > __strictest::_S_size
2503 ? _Len : __strictest::_S_size;
2508 using type =
typename aligned_storage<_S_len, alignment_value>::type;
2511 template <
size_t _Len,
typename... _Types>
2512 const size_t aligned_union<_Len, _Types...>::alignment_value;
2513#pragma GCC diagnostic pop
2517#if _GLIBCXX_USE_BUILTIN_TRAIT(__decay)
2518 template<
typename _Tp>
2520 {
using type = __decay(_Tp); };
2524 template<
typename _Up>
2525 struct __decay_selector
2526 : __conditional_t<is_const<const _Up>::value,
2531 template<
typename _Up,
size_t _Nm>
2532 struct __decay_selector<_Up[_Nm]>
2533 {
using type = _Up*; };
2535 template<
typename _Up>
2536 struct __decay_selector<_Up[]>
2537 {
using type = _Up*; };
2542 template<
typename _Tp>
2544 {
using type =
typename __decay_selector<_Tp>::type; };
2546 template<
typename _Tp>
2548 {
using type =
typename __decay_selector<_Tp>::type; };
2550 template<
typename _Tp>
2552 {
using type =
typename __decay_selector<_Tp>::type; };
2558 template<
typename _Tp>
2559 struct __strip_reference_wrapper
2564 template<
typename _Tp>
2567 using __type = _Tp&;
2571 template<
typename _Tp>
2572 using __decay_t =
typename decay<_Tp>::type;
2574 template<
typename _Tp>
2575 using __decay_and_strip = __strip_reference_wrapper<__decay_t<_Tp>>;
2581 template<
typename... _Cond>
2582 using _Require = __enable_if_t<__and_<_Cond...>::value>;
2585 template<
typename _Tp>
2586 using __remove_cvref_t
2592 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2594 {
using type = _Iftrue; };
2597 template<
typename _Iftrue,
typename _Iffalse>
2599 {
using type = _Iffalse; };
2602 template<
typename... _Tp>
2614 template<
typename _Tp>
2615 struct __success_type
2616 {
using type = _Tp; };
2618 struct __failure_type
2621 struct __do_common_type_impl
2623 template<
typename _Tp,
typename _Up>
2629 template<
typename _Tp,
typename _Up>
2630 static __success_type<__decay_t<__cond_t<_Tp, _Up>>>
2633#if __cplusplus > 201703L
2636 template<
typename _Tp,
typename _Up>
2637 static __success_type<__remove_cvref_t<__cond_t<const _Tp&, const _Up&>>>
2641 template<
typename,
typename>
2642 static __failure_type
2645 template<
typename _Tp,
typename _Up>
2646 static decltype(_S_test_2<_Tp, _Up>(0))
2656 template<
typename _Tp0>
2662 template<
typename _Tp1,
typename _Tp2,
2663 typename _Dp1 = __decay_t<_Tp1>,
typename _Dp2 = __decay_t<_Tp2>>
2664 struct __common_type_impl
2668 using type = common_type<_Dp1, _Dp2>;
2671 template<
typename _Tp1,
typename _Tp2>
2672 struct __common_type_impl<_Tp1, _Tp2, _Tp1, _Tp2>
2673 :
private __do_common_type_impl
2677 using type =
decltype(_S_test<_Tp1, _Tp2>(0));
2681 template<
typename _Tp1,
typename _Tp2>
2683 :
public __common_type_impl<_Tp1, _Tp2>::type
2686 template<
typename...>
2687 struct __common_type_pack
2690 template<
typename,
typename,
typename =
void>
2691 struct __common_type_fold;
2694 template<
typename _Tp1,
typename _Tp2,
typename... _Rp>
2696 :
public __common_type_fold<common_type<_Tp1, _Tp2>,
2697 __common_type_pack<_Rp...>>
2703 template<
typename _CTp,
typename... _Rp>
2704 struct __common_type_fold<_CTp, __common_type_pack<_Rp...>,
2705 __void_t<typename _CTp::type>>
2710 template<
typename _CTp,
typename _Rp>
2711 struct __common_type_fold<_CTp, _Rp, void>
2714 template<
typename _Tp,
bool = __is_enum(_Tp)>
2715 struct __underlying_type_impl
2717 using type = __underlying_type(_Tp);
2720 template<
typename _Tp>
2721 struct __underlying_type_impl<_Tp, false>
2726 template<
typename _Tp>
2728 :
public __underlying_type_impl<_Tp>
2732 template<
typename _Tp>
2733 struct __declval_protector
2735 static const bool __stop =
false;
2743 template<
typename _Tp>
2744 auto declval() noexcept -> decltype(__declval<_Tp>(0))
2746 static_assert(__declval_protector<_Tp>::__stop,
2747 "declval() must not be used!");
2748 return __declval<_Tp>(0);
2752 template<
typename _Signature>
2758 struct __invoke_memfun_ref { };
2759 struct __invoke_memfun_deref { };
2760 struct __invoke_memobj_ref { };
2761 struct __invoke_memobj_deref { };
2762 struct __invoke_other { };
2765 template<
typename _Tp,
typename _Tag>
2766 struct __result_of_success : __success_type<_Tp>
2767 {
using __invoke_type = _Tag; };
2770 struct __result_of_memfun_ref_impl
2772 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2773 static __result_of_success<
decltype(
2775 ), __invoke_memfun_ref> _S_test(
int);
2777 template<
typename...>
2778 static __failure_type _S_test(...);
2781 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2782 struct __result_of_memfun_ref
2783 :
private __result_of_memfun_ref_impl
2785 using type =
decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2789 struct __result_of_memfun_deref_impl
2791 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2792 static __result_of_success<
decltype(
2794 ), __invoke_memfun_deref> _S_test(
int);
2796 template<
typename...>
2797 static __failure_type _S_test(...);
2800 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2801 struct __result_of_memfun_deref
2802 :
private __result_of_memfun_deref_impl
2804 using type =
decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2808 struct __result_of_memobj_ref_impl
2810 template<
typename _Fp,
typename _Tp1>
2811 static __result_of_success<
decltype(
2813 ), __invoke_memobj_ref> _S_test(
int);
2815 template<
typename,
typename>
2816 static __failure_type _S_test(...);
2819 template<
typename _MemPtr,
typename _Arg>
2820 struct __result_of_memobj_ref
2821 :
private __result_of_memobj_ref_impl
2823 using type =
decltype(_S_test<_MemPtr, _Arg>(0));
2827 struct __result_of_memobj_deref_impl
2829 template<
typename _Fp,
typename _Tp1>
2830 static __result_of_success<
decltype(
2832 ), __invoke_memobj_deref> _S_test(
int);
2834 template<
typename,
typename>
2835 static __failure_type _S_test(...);
2838 template<
typename _MemPtr,
typename _Arg>
2839 struct __result_of_memobj_deref
2840 :
private __result_of_memobj_deref_impl
2842 using type =
decltype(_S_test<_MemPtr, _Arg>(0));
2845 template<
typename _MemPtr,
typename _Arg>
2846 struct __result_of_memobj;
2848 template<
typename _Res,
typename _Class,
typename _Arg>
2849 struct __result_of_memobj<_Res _Class::*, _Arg>
2851 using _Argval = __remove_cvref_t<_Arg>;
2852 using _MemPtr = _Res _Class::*;
2855 using type =
typename __conditional_t<__or_<is_same<_Argval, _Class>,
2856 is_base_of<_Class, _Argval>>::value,
2857 __result_of_memobj_ref<_MemPtr, _Arg>,
2858 __result_of_memobj_deref<_MemPtr, _Arg>
2862 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2863 struct __result_of_memfun;
2865 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2866 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2868 using _Argval =
typename remove_reference<_Arg>::type;
2869 using _MemPtr = _Res _Class::*;
2870 using type =
typename __conditional_t<is_base_of<_Class, _Argval>::value,
2871 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2872 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2881 template<
typename _Tp,
typename _Up = __remove_cvref_t<_Tp>>
2887 template<
typename _Tp,
typename _Up>
2893 template<bool, bool,
typename _Functor,
typename... _ArgTypes>
2894 struct __result_of_impl
2896 using type = __failure_type;
2899 template<
typename _MemPtr,
typename _Arg>
2900 struct __result_of_impl<true, false, _MemPtr, _Arg>
2901 :
public __result_of_memobj<__decay_t<_MemPtr>,
2902 typename __inv_unwrap<_Arg>::type>
2905 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2906 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2907 :
public __result_of_memfun<__decay_t<_MemPtr>,
2908 typename __inv_unwrap<_Arg>::type, _Args...>
2912 struct __result_of_other_impl
2914 template<
typename _Fn,
typename... _Args>
2915 static __result_of_success<
decltype(
2917 ), __invoke_other> _S_test(
int);
2919 template<
typename...>
2920 static __failure_type _S_test(...);
2923 template<
typename _Functor,
typename... _ArgTypes>
2924 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2925 :
private __result_of_other_impl
2927 using type =
decltype(_S_test<_Functor, _ArgTypes...>(0));
2931 template<
typename _Functor,
typename... _ArgTypes>
2932 struct __invoke_result
2933 :
public __result_of_impl<
2934 is_member_object_pointer<
2935 typename remove_reference<_Functor>::type
2937 is_member_function_pointer<
2938 typename remove_reference<_Functor>::type
2940 _Functor, _ArgTypes...
2945 template<
typename _Fn,
typename... _Args>
2946 using __invoke_result_t =
typename __invoke_result<_Fn, _Args...>::type;
2949 template<
typename _Functor,
typename... _ArgTypes>
2950 struct result_of<_Functor(_ArgTypes...)>
2951 :
public __invoke_result<_Functor, _ArgTypes...>
2952 { } _GLIBCXX17_DEPRECATED_SUGGEST(
"std::invoke_result");
2954#if __cplusplus >= 201402L
2955#pragma GCC diagnostic push
2956#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2958 template<
size_t _Len,
2959 size_t _Align = __aligned_storage_default_alignment(_Len)>
2960 using aligned_storage_t _GLIBCXX23_DEPRECATED =
typename aligned_storage<_Len, _Align>::type;
2962 template <
size_t _Len,
typename... _Types>
2963 using aligned_union_t _GLIBCXX23_DEPRECATED =
typename aligned_union<_Len, _Types...>::type;
2964#pragma GCC diagnostic pop
2967 template<
typename _Tp>
2968 using decay_t =
typename decay<_Tp>::type;
2971 template<
bool _Cond,
typename _Tp =
void>
2975 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2976 using conditional_t =
typename conditional<_Cond, _Iftrue, _Iffalse>::type;
2979 template<
typename... _Tp>
2983 template<
typename _Tp>
2987 template<
typename _Tp>
2991#ifdef __cpp_lib_void_t
2993 template<typename...> using void_t = void;
3003 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
3004 struct __detected_or
3011 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
3012 requires requires {
typename _Op<_Args...>; }
3013 struct __detected_or<_Def, _Op, _Args...>
3015 using type = _Op<_Args...>;
3020 template<
typename _Default,
typename _AlwaysVoid,
3021 template<
typename...>
class _Op,
typename... _Args>
3024 using type = _Default;
3029 template<
typename _Default,
template<
typename...>
class _Op,
3031 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
3033 using type = _Op<_Args...>;
3037 template<
typename _Default,
template<
typename...>
class _Op,
3039 using __detected_or = __detector<_Default, void, _Op, _Args...>;
3043 template<
typename _Default,
template<
typename...>
class _Op,
3045 using __detected_or_t
3046 =
typename __detected_or<_Default, _Op, _Args...>::type;
3052#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
3053 template<typename _Tp, typename = __void_t<>> \
3054 struct __has_##_NTYPE \
3057 template<typename _Tp> \
3058 struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
3062 template <
typename _Tp>
3063 struct __is_swappable;
3065 template <
typename _Tp>
3066 struct __is_nothrow_swappable;
3073 template<
typename _Tp>
3074 struct __is_tuple_like
3075 :
public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type
3079 template<
typename _Tp>
3080 _GLIBCXX20_CONSTEXPR
3082 _Require<__not_<__is_tuple_like<_Tp>>,
3086 noexcept(__and_<is_nothrow_move_constructible<_Tp>,
3089 template<
typename _Tp,
size_t _Nm>
3090 _GLIBCXX20_CONSTEXPR
3092 __enable_if_t<__is_swappable<_Tp>::value>
3093 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
3094 noexcept(__is_nothrow_swappable<_Tp>::value);
3097 namespace __swappable_details {
3100 struct __do_is_swappable_impl
3102 template<
typename _Tp,
typename
3104 static true_type __test(
int);
3110 struct __do_is_nothrow_swappable_impl
3112 template<
typename _Tp>
3113 static __bool_constant<
3123 template<
typename _Tp>
3124 struct __is_swappable_impl
3125 :
public __swappable_details::__do_is_swappable_impl
3127 using type =
decltype(__test<_Tp>(0));
3130 template<
typename _Tp>
3131 struct __is_nothrow_swappable_impl
3132 :
public __swappable_details::__do_is_nothrow_swappable_impl
3134 using type =
decltype(__test<_Tp>(0));
3137 template<
typename _Tp>
3138 struct __is_swappable
3139 :
public __is_swappable_impl<_Tp>::type
3142 template<
typename _Tp>
3143 struct __is_nothrow_swappable
3144 :
public __is_nothrow_swappable_impl<_Tp>::type
3148#ifdef __cpp_lib_is_swappable
3152 template<
typename _Tp>
3154 :
public __is_swappable_impl<_Tp>::type
3156 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3157 "template argument must be a complete class or an unbounded array");
3161 template<
typename _Tp>
3162 struct is_nothrow_swappable
3163 :
public __is_nothrow_swappable_impl<_Tp>::type
3165 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3166 "template argument must be a complete class or an unbounded array");
3169#if __cplusplus >= 201402L
3171 template<
typename _Tp>
3172 _GLIBCXX17_INLINE
constexpr bool is_swappable_v =
3173 is_swappable<_Tp>::value;
3176 template<
typename _Tp>
3177 _GLIBCXX17_INLINE
constexpr bool is_nothrow_swappable_v =
3178 is_nothrow_swappable<_Tp>::value;
3182 namespace __swappable_with_details {
3185 struct __do_is_swappable_with_impl
3187 template<
typename _Tp,
typename _Up,
typename
3193 template<
typename,
typename>
3197 struct __do_is_nothrow_swappable_with_impl
3199 template<
typename _Tp,
typename _Up>
3200 static __bool_constant<
3206 template<
typename,
typename>
3212 template<
typename _Tp,
typename _Up>
3213 struct __is_swappable_with_impl
3214 :
public __swappable_with_details::__do_is_swappable_with_impl
3216 using type =
decltype(__test<_Tp, _Up>(0));
3220 template<
typename _Tp>
3221 struct __is_swappable_with_impl<_Tp&, _Tp&>
3222 :
public __swappable_details::__do_is_swappable_impl
3224 using type =
decltype(__test<_Tp&>(0));
3227 template<
typename _Tp,
typename _Up>
3228 struct __is_nothrow_swappable_with_impl
3229 :
public __swappable_with_details::__do_is_nothrow_swappable_with_impl
3231 using type =
decltype(__test<_Tp, _Up>(0));
3235 template<
typename _Tp>
3236 struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
3237 :
public __swappable_details::__do_is_nothrow_swappable_impl
3239 using type =
decltype(__test<_Tp&>(0));
3244 template<
typename _Tp,
typename _Up>
3245 struct is_swappable_with
3246 :
public __is_swappable_with_impl<_Tp, _Up>::type
3248 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3249 "first template argument must be a complete class or an unbounded array");
3250 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3251 "second template argument must be a complete class or an unbounded array");
3255 template<
typename _Tp,
typename _Up>
3256 struct is_nothrow_swappable_with
3257 :
public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
3259 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3260 "first template argument must be a complete class or an unbounded array");
3261 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3262 "second template argument must be a complete class or an unbounded array");
3265#if __cplusplus >= 201402L
3267 template<
typename _Tp,
typename _Up>
3268 _GLIBCXX17_INLINE
constexpr bool is_swappable_with_v =
3269 is_swappable_with<_Tp, _Up>::value;
3272 template<
typename _Tp,
typename _Up>
3273 _GLIBCXX17_INLINE
constexpr bool is_nothrow_swappable_with_v =
3274 is_nothrow_swappable_with<_Tp, _Up>::value;
3284 template<
typename _Result,
typename _Ret,
3286 struct __is_invocable_impl
3293 template<
typename _Result,
typename _Ret>
3294 struct __is_invocable_impl<_Result, _Ret,
3296 __void_t<typename _Result::type>>
3302#pragma GCC diagnostic push
3303#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3305 template<
typename _Result,
typename _Ret>
3306 struct __is_invocable_impl<_Result, _Ret,
3308 __void_t<typename _Result::type>>
3312 using _Res_t =
typename _Result::type;
3316 static _Res_t _S_get() noexcept;
3319 template<typename _Tp>
3320 static
void _S_conv(__type_identity_t<_Tp>) noexcept;
3323 template<typename _Tp,
3324 bool _Nothrow = noexcept(_S_conv<_Tp>(_S_get())),
3325 typename = decltype(_S_conv<_Tp>(_S_get())),
3326#if __has_builtin(__reference_converts_from_temporary)
3327 bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
3329 bool _Dangle =
false
3332 static __bool_constant<_Nothrow && !_Dangle>
3335 template<
typename _Tp,
bool = false>
3341 using type =
decltype(_S_test<_Ret,
true>(1));
3344 using __nothrow_conv =
decltype(_S_test<_Ret>(1));
3346#pragma GCC diagnostic pop
3348 template<
typename _Fn,
typename... _ArgTypes>
3349 struct __is_invocable
3350#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3351 : __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
3353 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3357 template<
typename _Fn,
typename _Tp,
typename... _Args>
3358 constexpr bool __call_is_nt(__invoke_memfun_ref)
3360 using _Up =
typename __inv_unwrap<_Tp>::type;
3365 template<
typename _Fn,
typename _Tp,
typename... _Args>
3366 constexpr bool __call_is_nt(__invoke_memfun_deref)
3372 template<
typename _Fn,
typename _Tp>
3373 constexpr bool __call_is_nt(__invoke_memobj_ref)
3375 using _Up =
typename __inv_unwrap<_Tp>::type;
3379 template<
typename _Fn,
typename _Tp>
3380 constexpr bool __call_is_nt(__invoke_memobj_deref)
3385 template<
typename _Fn,
typename... _Args>
3386 constexpr bool __call_is_nt(__invoke_other)
3391 template<
typename _Result,
typename _Fn,
typename... _Args>
3392 struct __call_is_nothrow
3394 std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
3398 template<
typename _Fn,
typename... _Args>
3399 using __call_is_nothrow_
3400 = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
3403 template<
typename _Fn,
typename... _Args>
3404 struct __is_nothrow_invocable
3405#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3406 : __bool_constant<__is_nothrow_invocable(_Fn, _Args...)>
3408 : __and_<__is_invocable<_Fn, _Args...>,
3409 __call_is_nothrow_<_Fn, _Args...>>::type
3413#pragma GCC diagnostic push
3414#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3415 struct __nonesuchbase {};
3416 struct __nonesuch :
private __nonesuchbase {
3417 ~__nonesuch() =
delete;
3418 __nonesuch(__nonesuch
const&) =
delete;
3419 void operator=(__nonesuch
const&) =
delete;
3421#pragma GCC diagnostic pop
3424#ifdef __cpp_lib_is_invocable
3426 template<typename _Functor, typename... _ArgTypes>
3427 struct invoke_result
3428 :
public __invoke_result<_Functor, _ArgTypes...>
3430 static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
3431 "_Functor must be a complete class or an unbounded array");
3432 static_assert((std::__is_complete_or_unbounded(
3433 __type_identity<_ArgTypes>{}) && ...),
3434 "each argument type must be a complete class or an unbounded array");
3438 template<
typename _Fn,
typename... _Args>
3439 using invoke_result_t =
typename invoke_result<_Fn, _Args...>::type;
3442 template<
typename _Fn,
typename... _ArgTypes>
3444#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3445 :
public __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
3447 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3450 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3451 "_Fn must be a complete class or an unbounded array");
3452 static_assert((std::__is_complete_or_unbounded(
3453 __type_identity<_ArgTypes>{}) && ...),
3454 "each argument type must be a complete class or an unbounded array");
3458 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3459 struct is_invocable_r
3460 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
3462 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3463 "_Fn must be a complete class or an unbounded array");
3464 static_assert((std::__is_complete_or_unbounded(
3465 __type_identity<_ArgTypes>{}) && ...),
3466 "each argument type must be a complete class or an unbounded array");
3467 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3468 "_Ret must be a complete class or an unbounded array");
3472 template<
typename _Fn,
typename... _ArgTypes>
3473 struct is_nothrow_invocable
3474#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3475 :
public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)>
3477 : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
3478 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3481 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3482 "_Fn must be a complete class or an unbounded array");
3483 static_assert((std::__is_complete_or_unbounded(
3484 __type_identity<_ArgTypes>{}) && ...),
3485 "each argument type must be a complete class or an unbounded array");
3492 template<
typename _Result,
typename _Ret>
3493 using __is_nt_invocable_impl
3494 =
typename __is_invocable_impl<_Result, _Ret>::__nothrow_conv;
3498 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3499 struct is_nothrow_invocable_r
3500 : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
3501 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3503 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3504 "_Fn must be a complete class or an unbounded array");
3505 static_assert((std::__is_complete_or_unbounded(
3506 __type_identity<_ArgTypes>{}) && ...),
3507 "each argument type must be a complete class or an unbounded array");
3508 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3509 "_Ret must be a complete class or an unbounded array");
3513#if __cpp_lib_type_trait_variable_templates
3528template <
typename _Tp>
3530template <
typename _Tp>
3531 inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
3532template <
typename _Tp>
3534template <
typename _Tp>
3537#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
3538template <
typename _Tp>
3539 inline constexpr bool is_array_v = __is_array(_Tp);
3541template <
typename _Tp>
3542 inline constexpr bool is_array_v =
false;
3543template <
typename _Tp>
3544 inline constexpr bool is_array_v<_Tp[]> =
true;
3545template <
typename _Tp,
size_t _Num>
3546 inline constexpr bool is_array_v<_Tp[_Num]> =
true;
3549#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
3550template <
typename _Tp>
3551 inline constexpr bool is_pointer_v = __is_pointer(_Tp);
3553template <
typename _Tp>
3554 inline constexpr bool is_pointer_v =
false;
3555template <
typename _Tp>
3556 inline constexpr bool is_pointer_v<_Tp*> =
true;
3557template <
typename _Tp>
3558 inline constexpr bool is_pointer_v<_Tp* const> =
true;
3559template <
typename _Tp>
3560 inline constexpr bool is_pointer_v<_Tp* volatile> =
true;
3561template <
typename _Tp>
3562 inline constexpr bool is_pointer_v<_Tp* const volatile> =
true;
3565template <
typename _Tp>
3566 inline constexpr bool is_lvalue_reference_v =
false;
3567template <
typename _Tp>
3568 inline constexpr bool is_lvalue_reference_v<_Tp&> =
true;
3569template <
typename _Tp>
3570 inline constexpr bool is_rvalue_reference_v =
false;
3571template <
typename _Tp>
3572 inline constexpr bool is_rvalue_reference_v<_Tp&&> =
true;
3574#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
3575template <
typename _Tp>
3576 inline constexpr bool is_member_object_pointer_v =
3577 __is_member_object_pointer(_Tp);
3579template <
typename _Tp>
3580 inline constexpr bool is_member_object_pointer_v =
3584#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
3585template <
typename _Tp>
3586 inline constexpr bool is_member_function_pointer_v =
3587 __is_member_function_pointer(_Tp);
3589template <
typename _Tp>
3590 inline constexpr bool is_member_function_pointer_v =
3594#if __cpp_impl_reflection >= 202506L
3595template <
typename _Tp>
3596 inline constexpr bool is_reflection_v =
false;
3598 inline constexpr bool is_reflection_v<
decltype(^^int)> =
true;
3600 inline constexpr bool is_reflection_v<
const decltype(^^int)> =
true;
3602 inline constexpr bool is_reflection_v<
volatile decltype(^^int)> =
true;
3604 inline constexpr bool is_reflection_v<
const volatile decltype(^^int)> =
true;
3607template <
typename _Tp>
3608 inline constexpr bool is_enum_v = __is_enum(_Tp);
3609template <
typename _Tp>
3610 inline constexpr bool is_union_v = __is_union(_Tp);
3611template <
typename _Tp>
3612 inline constexpr bool is_class_v = __is_class(_Tp);
3615#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
3616template <
typename _Tp>
3617 inline constexpr bool is_reference_v = __is_reference(_Tp);
3619template <
typename _Tp>
3620 inline constexpr bool is_reference_v =
false;
3621template <
typename _Tp>
3622 inline constexpr bool is_reference_v<_Tp&> =
true;
3623template <
typename _Tp>
3624 inline constexpr bool is_reference_v<_Tp&&> =
true;
3627template <
typename _Tp>
3629template <
typename _Tp>
3632#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
3633template <
typename _Tp>
3634 inline constexpr bool is_object_v = __is_object(_Tp);
3636template <
typename _Tp>
3640template <
typename _Tp>
3642template <
typename _Tp>
3643 inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
3645#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
3646template <
typename _Tp>
3647 inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
3649template <
typename _Tp>
3653#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
3654template <
typename _Tp>
3655 inline constexpr bool is_const_v = __is_const(_Tp);
3657template <
typename _Tp>
3658 inline constexpr bool is_const_v =
false;
3659template <
typename _Tp>
3660 inline constexpr bool is_const_v<const _Tp> =
true;
3663#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
3664template <
typename _Tp>
3665 inline constexpr bool is_function_v = __is_function(_Tp);
3667template <
typename _Tp>
3668 inline constexpr bool is_function_v = !is_const_v<const _Tp>;
3669template <
typename _Tp>
3670 inline constexpr bool is_function_v<_Tp&> =
false;
3671template <
typename _Tp>
3672 inline constexpr bool is_function_v<_Tp&&> =
false;
3675#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
3676template <
typename _Tp>
3677 inline constexpr bool is_volatile_v = __is_volatile(_Tp);
3679template <
typename _Tp>
3680 inline constexpr bool is_volatile_v =
false;
3681template <
typename _Tp>
3682 inline constexpr bool is_volatile_v<volatile _Tp> =
true;
3685template <
typename _Tp>
3686 _GLIBCXX26_DEPRECATED_SUGGEST(
"is_trivially_default_constructible_v && is_trivially_copyable_v")
3687 inline constexpr
bool is_trivial_v = __is_trivial(_Tp);
3688template <typename _Tp>
3689 inline constexpr
bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
3690template <typename _Tp>
3691 inline constexpr
bool is_standard_layout_v = __is_standard_layout(_Tp);
3692template <typename _Tp>
3693 _GLIBCXX20_DEPRECATED_SUGGEST(
"is_standard_layout_v && is_trivial_v")
3694 inline constexpr
bool is_pod_v = __is_pod(_Tp);
3695template <typename _Tp>
3696 _GLIBCXX17_DEPRECATED
3697 inline constexpr
bool is_literal_type_v = __is_literal_type(_Tp);
3698template <typename _Tp>
3699 inline constexpr
bool is_empty_v = __is_empty(_Tp);
3700template <typename _Tp>
3701 inline constexpr
bool is_polymorphic_v = __is_polymorphic(_Tp);
3702template <typename _Tp>
3703 inline constexpr
bool is_abstract_v = __is_abstract(_Tp);
3704template <typename _Tp>
3705 inline constexpr
bool is_final_v = __is_final(_Tp);
3707template <typename _Tp>
3708 inline constexpr
bool is_signed_v =
is_signed<_Tp>::value;
3709template <typename _Tp>
3710 inline constexpr
bool is_unsigned_v =
is_unsigned<_Tp>::value;
3712template <typename _Tp, typename... _Args>
3713 inline constexpr
bool is_constructible_v = __is_constructible(_Tp, _Args...);
3714template <typename _Tp>
3715 inline constexpr
bool is_default_constructible_v = __is_constructible(_Tp);
3716template <typename _Tp>
3717 inline constexpr
bool is_copy_constructible_v
3718 = __is_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3719template <typename _Tp>
3720 inline constexpr
bool is_move_constructible_v
3721 = __is_constructible(_Tp, __add_rval_ref_t<_Tp>);
3723template <typename _Tp, typename _Up>
3724 inline constexpr
bool is_assignable_v = __is_assignable(_Tp, _Up);
3725template <typename _Tp>
3726 inline constexpr
bool is_copy_assignable_v
3727 = __is_assignable(__add_lval_ref_t<_Tp>, __add_lval_ref_t<const _Tp>);
3728template <typename _Tp>
3729 inline constexpr
bool is_move_assignable_v
3730 = __is_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3732#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_destructible)
3733template <
typename _Tp>
3734 inline constexpr bool is_destructible_v = __is_destructible(_Tp);
3736template <
typename _Tp>
3740template <
typename _Tp,
typename... _Args>
3741 inline constexpr bool is_trivially_constructible_v
3742 = __is_trivially_constructible(_Tp, _Args...);
3743template <
typename _Tp>
3744 inline constexpr bool is_trivially_default_constructible_v
3745 = __is_trivially_constructible(_Tp);
3746template <
typename _Tp>
3747 inline constexpr bool is_trivially_copy_constructible_v
3748 = __is_trivially_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3749template <
typename _Tp>
3750 inline constexpr bool is_trivially_move_constructible_v
3751 = __is_trivially_constructible(_Tp, __add_rval_ref_t<_Tp>);
3753template <
typename _Tp,
typename _Up>
3754 inline constexpr bool is_trivially_assignable_v
3755 = __is_trivially_assignable(_Tp, _Up);
3756template <
typename _Tp>
3757 inline constexpr bool is_trivially_copy_assignable_v
3758 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3759 __add_lval_ref_t<const _Tp>);
3760template <
typename _Tp>
3761 inline constexpr bool is_trivially_move_assignable_v
3762 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3763 __add_rval_ref_t<_Tp>);
3765#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_trivially_destructible)
3766template <
typename _Tp>
3767 inline constexpr bool is_trivially_destructible_v
3768 = __is_trivially_destructible(_Tp);
3770template <
typename _Tp>
3771 inline constexpr bool is_trivially_destructible_v =
false;
3773template <
typename _Tp>
3774 requires (!is_reference_v<_Tp>) &&
requires (_Tp& __t) { __t.~_Tp(); }
3775 inline constexpr bool is_trivially_destructible_v<_Tp>
3776 = __has_trivial_destructor(_Tp);
3777template <
typename _Tp>
3778 inline constexpr bool is_trivially_destructible_v<_Tp&> =
true;
3779template <
typename _Tp>
3780 inline constexpr bool is_trivially_destructible_v<_Tp&&> =
true;
3781template <
typename _Tp,
size_t _Nm>
3782 inline constexpr bool is_trivially_destructible_v<_Tp[_Nm]>
3783 = is_trivially_destructible_v<_Tp>;
3785template <
typename _Tp>
3786 inline constexpr bool is_trivially_destructible_v =
3790template <
typename _Tp,
typename... _Args>
3791 inline constexpr bool is_nothrow_constructible_v
3792 = __is_nothrow_constructible(_Tp, _Args...);
3793template <
typename _Tp>
3794 inline constexpr bool is_nothrow_default_constructible_v
3795 = __is_nothrow_constructible(_Tp);
3796template <
typename _Tp>
3797 inline constexpr bool is_nothrow_copy_constructible_v
3798 = __is_nothrow_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3799template <
typename _Tp>
3800 inline constexpr bool is_nothrow_move_constructible_v
3801 = __is_nothrow_constructible(_Tp, __add_rval_ref_t<_Tp>);
3803template <
typename _Tp,
typename _Up>
3804 inline constexpr bool is_nothrow_assignable_v
3805 = __is_nothrow_assignable(_Tp, _Up);
3806template <
typename _Tp>
3807 inline constexpr bool is_nothrow_copy_assignable_v
3808 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>,
3809 __add_lval_ref_t<const _Tp>);
3810template <
typename _Tp>
3811 inline constexpr bool is_nothrow_move_assignable_v
3812 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3814#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_destructible)
3815template <
typename _Tp>
3816 inline constexpr bool is_nothrow_destructible_v
3817 = __is_nothrow_destructible(_Tp);
3819template <
typename _Tp>
3820 inline constexpr bool is_nothrow_destructible_v =
3824template <
typename _Tp>
3825 inline constexpr bool has_virtual_destructor_v
3826 = __has_virtual_destructor(_Tp);
3828template <
typename _Tp>
3829 inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
3831#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) \
3832 && (!defined(__clang__) || __clang_major__ >= 20)
3833template <
typename _Tp>
3834 inline constexpr size_t rank_v = __array_rank(_Tp);
3836template <
typename _Tp>
3837 inline constexpr size_t rank_v = 0;
3838template <
typename _Tp,
size_t _Size>
3839 inline constexpr size_t rank_v<_Tp[_Size]> = 1 + rank_v<_Tp>;
3840template <
typename _Tp>
3841 inline constexpr size_t rank_v<_Tp[]> = 1 + rank_v<_Tp>;
3844template <
typename _Tp,
unsigned _Idx = 0>
3845 inline constexpr size_t extent_v = 0;
3846template <
typename _Tp,
size_t _Size>
3847 inline constexpr size_t extent_v<_Tp[_Size], 0> = _Size;
3848template <
typename _Tp,
unsigned _Idx,
size_t _Size>
3849 inline constexpr size_t extent_v<_Tp[_Size], _Idx> = extent_v<_Tp, _Idx - 1>;
3850template <
typename _Tp>
3851 inline constexpr size_t extent_v<_Tp[], 0> = 0;
3852template <
typename _Tp,
unsigned _Idx>
3853 inline constexpr size_t extent_v<_Tp[], _Idx> = extent_v<_Tp, _Idx - 1>;
3855#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
3856template <
typename _Tp,
typename _Up>
3857 inline constexpr bool is_same_v = __is_same(_Tp, _Up);
3859template <
typename _Tp,
typename _Up>
3860 inline constexpr bool is_same_v =
false;
3861template <
typename _Tp>
3862 inline constexpr bool is_same_v<_Tp, _Tp> =
true;
3864template <
typename _Base,
typename _Derived>
3865 inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
3866#ifdef __cpp_lib_is_virtual_base_of
3867template <
typename _Base,
typename _Derived>
3868 inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived);
3870#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
3871template <
typename _From,
typename _To>
3872 inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
3874template <
typename _From,
typename _To>
3875 inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
3877template<
typename _Fn,
typename... _Args>
3878 inline constexpr bool is_invocable_v
3879#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3880 = __is_invocable(_Fn, _Args...);
3882 = is_invocable<_Fn, _Args...>::value;
3884template<
typename _Fn,
typename... _Args>
3885 inline constexpr bool is_nothrow_invocable_v
3886#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3887 = __is_nothrow_invocable(_Fn, _Args...);
3889 = is_nothrow_invocable<_Fn, _Args...>::value;
3891template<
typename _Ret,
typename _Fn,
typename... _Args>
3892 inline constexpr bool is_invocable_r_v
3893 = is_invocable_r<_Ret, _Fn, _Args...>::value;
3894template<
typename _Ret,
typename _Fn,
typename... _Args>
3895 inline constexpr bool is_nothrow_invocable_r_v
3896 = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
3900#ifdef __cpp_lib_has_unique_object_representations
3903 template<typename _Tp>
3904 struct has_unique_object_representations
3905 : bool_constant<__has_unique_object_representations(
3906 remove_cv_t<remove_all_extents_t<_Tp>>
3909 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3910 "template argument must be a complete class or an unbounded array");
3913# if __cpp_lib_type_trait_variable_templates
3915 template<typename _Tp>
3916 inline constexpr bool has_unique_object_representations_v
3917 = has_unique_object_representations<_Tp>::value;
3921#ifdef __cpp_lib_is_aggregate
3924 template<typename _Tp>
3926 : bool_constant<__is_aggregate(remove_cv_t<_Tp>)>
3929# if __cpp_lib_type_trait_variable_templates
3934 template<
typename _Tp>
3935 inline constexpr bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>);
3939#if __cpp_lib_is_structural >= 202603L
3942 template<typename _Tp>
3943 struct is_structural
3944 : bool_constant<__builtin_is_structural(_Tp)>
3951 template<
typename _Tp>
3952 inline constexpr bool is_structural_v
3953 = __builtin_is_structural(_Tp);
3960#ifdef __cpp_lib_remove_cvref
3961# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
3962 template<
typename _Tp>
3964 {
using type = __remove_cvref(_Tp); };
3966 template<
typename _Tp>
3968 {
using type =
typename remove_cv<_Tp>::type; };
3970 template<
typename _Tp>
3971 struct remove_cvref<_Tp&>
3972 {
using type =
typename remove_cv<_Tp>::type; };
3974 template<
typename _Tp>
3975 struct remove_cvref<_Tp&&>
3976 {
using type =
typename remove_cv<_Tp>::type; };
3979 template<
typename _Tp>
3980 using remove_cvref_t =
typename remove_cvref<_Tp>::type;
3984#ifdef __cpp_lib_unwrap_ref
3989 template<
typename _Tp>
3990 struct unwrap_reference {
using type = _Tp; };
3992 template<
typename _Tp>
3995 template<
typename _Tp>
3996 using unwrap_reference_t =
typename unwrap_reference<_Tp>::type;
4003 template<
typename _Tp>
4004 struct unwrap_ref_decay {
using type = unwrap_reference_t<decay_t<_Tp>>; };
4006 template<
typename _Tp>
4007 using unwrap_ref_decay_t =
typename unwrap_ref_decay<_Tp>::type;
4011#ifdef __cpp_lib_bounded_array_traits
4015# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_bounded_array)
4016 template<
typename _Tp>
4017 inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
4019 template<
typename _Tp>
4020 inline constexpr bool is_bounded_array_v =
false;
4022 template<
typename _Tp,
size_t _Size>
4023 inline constexpr bool is_bounded_array_v<_Tp[_Size]> =
true;
4029# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unbounded_array)
4030 template<
typename _Tp>
4031 inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp);
4033 template<
typename _Tp>
4034 inline constexpr bool is_unbounded_array_v =
false;
4036 template<
typename _Tp>
4037 inline constexpr bool is_unbounded_array_v<_Tp[]> =
true;
4042 template<
typename _Tp>
4043 struct is_bounded_array
4044 :
public bool_constant<is_bounded_array_v<_Tp>>
4049 template<
typename _Tp>
4050 struct is_unbounded_array
4051 :
public bool_constant<is_unbounded_array_v<_Tp>>
4055#if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L
4058 template<
typename _Tp,
typename _Up>
4060 : bool_constant<__is_layout_compatible(_Tp, _Up)>
4065 template<
typename _Tp,
typename _Up>
4067 = __is_layout_compatible(_Tp, _Up);
4069#if __has_builtin(__builtin_is_corresponding_member)
4070# ifndef __cpp_lib_is_layout_compatible
4071# error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set"
4075 template<
typename _S1,
typename _S2,
typename _M1,
typename _M2>
4078 {
return __builtin_is_corresponding_member(__m1, __m2); }
4082#if __has_builtin(__is_pointer_interconvertible_base_of) \
4083 && __cplusplus >= 202002L
4086 template<
typename _Base,
typename _Derived>
4088 : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)>
4093 template<
typename _Base,
typename _Derived>
4095 = __is_pointer_interconvertible_base_of(_Base, _Derived);
4097#if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
4098# ifndef __cpp_lib_is_pointer_interconvertible
4099# error "libstdc++ bug: is_pointer_interconvertible available but FTM is not set"
4105 template<
typename _Tp,
typename _Mem>
4108 {
return __builtin_is_pointer_interconvertible_with_class(__mp); }
4112#ifdef __cpp_lib_is_scoped_enum
4116# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
4117 template<
typename _Tp>
4118 struct is_scoped_enum
4119 : bool_constant<__is_scoped_enum(_Tp)>
4122 template<
typename _Tp>
4123 struct is_scoped_enum
4127 template<
typename _Tp>
4128 requires __is_enum(_Tp)
4129 &&
requires(remove_cv_t<_Tp> __t) { __t = __t; }
4130 struct is_scoped_enum<_Tp>
4131 : bool_constant<!requires(_Tp __t, void(*__f)(int)) { __f(__t); }>
4137# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
4138 template<
typename _Tp>
4139 inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
4141 template<
typename _Tp>
4142 inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
4146#ifdef __cpp_lib_is_implicit_lifetime
4150 template<
typename _Tp>
4151 struct is_implicit_lifetime
4152 : bool_constant<__builtin_is_implicit_lifetime(_Tp)>
4157 template<
typename _Tp>
4158 inline constexpr bool is_implicit_lifetime_v
4159 = __builtin_is_implicit_lifetime(_Tp);
4162#ifdef __cpp_lib_reference_from_temporary
4167 template<typename _Tp, typename _Up>
4168 struct reference_constructs_from_temporary
4169 :
public bool_constant<__reference_constructs_from_temporary(_Tp, _Up)>
4171 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
4172 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
4173 "template argument must be a complete class or an unbounded array");
4180 template<
typename _Tp,
typename _Up>
4181 struct reference_converts_from_temporary
4182 :
public bool_constant<__reference_converts_from_temporary(_Tp, _Up)>
4184 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
4185 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
4186 "template argument must be a complete class or an unbounded array");
4191 template<
typename _Tp,
typename _Up>
4192 inline constexpr bool reference_constructs_from_temporary_v
4193 = reference_constructs_from_temporary<_Tp, _Up>::value;
4197 template<
typename _Tp,
typename _Up>
4198 inline constexpr bool reference_converts_from_temporary_v
4199 = reference_converts_from_temporary<_Tp, _Up>::value;
4202#ifdef __cpp_lib_is_constant_evaluated
4205 [[__gnu__::__always_inline__]]
4207 is_constant_evaluated() noexcept
4209#if __cpp_if_consteval >= 202106L
4210 if consteval {
return true; }
else {
return false; }
4212 return __builtin_is_constant_evaluated();
4217#if __cplusplus >= 202002L
4219 template<
typename _From,
typename _To>
4220 using __copy_cv =
typename __match_cv_qualifiers<_From, _To>::__type;
4222 template<
typename _Xp,
typename _Yp>
4226 template<
typename _Ap,
typename _Bp,
typename =
void>
4227 struct __common_ref_impl
4231 template<
typename _Ap,
typename _Bp>
4232 using __common_ref =
typename __common_ref_impl<_Ap, _Bp>::type;
4235 template<
typename _Xp,
typename _Yp>
4236 using __condres_cvref
4237 = __cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>;
4240 template<
typename _Xp,
typename _Yp>
4241 struct __common_ref_impl<_Xp&, _Yp&, __void_t<__condres_cvref<_Xp, _Yp>>>
4243 __condres_cvref<_Xp, _Yp>>
4247 template<
typename _Xp,
typename _Yp>
4251 template<
typename _Xp,
typename _Yp>
4252 struct __common_ref_impl<_Xp&&, _Yp&&,
4253 _Require<is_convertible<_Xp&&, __common_ref_C<_Xp, _Yp>>,
4254 is_convertible<_Yp&&, __common_ref_C<_Xp, _Yp>>>>
4255 {
using type = __common_ref_C<_Xp, _Yp>; };
4258 template<
typename _Xp,
typename _Yp>
4259 using __common_ref_D = __common_ref<const _Xp&, _Yp&>;
4262 template<
typename _Xp,
typename _Yp>
4263 struct __common_ref_impl<_Xp&&, _Yp&,
4264 _Require<is_convertible<_Xp&&, __common_ref_D<_Xp, _Yp>>>>
4265 {
using type = __common_ref_D<_Xp, _Yp>; };
4268 template<
typename _Xp,
typename _Yp>
4269 struct __common_ref_impl<_Xp&, _Yp&&>
4270 : __common_ref_impl<_Yp&&, _Xp&>
4274 template<
typename _Tp,
typename _Up,
4275 template<
typename>
class _TQual,
template<
typename>
class _UQual>
4276 struct basic_common_reference
4280 template<
typename _Tp>
4282 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>; };
4284 template<
typename _Tp>
4286 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&; };
4288 template<
typename _Tp>
4289 struct __xref<_Tp&&>
4290 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&&; };
4292 template<
typename _Tp1,
typename _Tp2>
4293 using __basic_common_ref
4294 =
typename basic_common_reference<remove_cvref_t<_Tp1>,
4295 remove_cvref_t<_Tp2>,
4296 __xref<_Tp1>::template __type,
4297 __xref<_Tp2>::template __type>::type;
4300 template<
typename... _Tp>
4301 struct common_reference;
4303 template<
typename... _Tp>
4308 struct common_reference<>
4312 template<
typename _Tp0>
4313 struct common_reference<_Tp0>
4314 {
using type = _Tp0; };
4317 template<
typename _Tp1,
typename _Tp2,
int _Bullet = 1>
4318 struct __common_reference_impl
4319 : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1>
4323 template<
typename _Tp1,
typename _Tp2>
4324 struct common_reference<_Tp1, _Tp2>
4325 : __common_reference_impl<_Tp1, _Tp2>
4329 template<
typename _Tp1,
typename _Tp2>
4330 requires is_reference_v<_Tp1> && is_reference_v<_Tp2>
4331 &&
requires {
typename __common_ref<_Tp1, _Tp2>; }
4332#if __cpp_lib_common_reference
4333 && is_convertible_v<add_pointer_t<_Tp1>,
4335 && is_convertible_v<add_pointer_t<_Tp2>,
4338 struct __common_reference_impl<_Tp1, _Tp2, 1>
4339 {
using type = __common_ref<_Tp1, _Tp2>; };
4342 template<
typename _Tp1,
typename _Tp2>
4343 requires requires {
typename __basic_common_ref<_Tp1, _Tp2>; }
4344 struct __common_reference_impl<_Tp1, _Tp2, 2>
4345 {
using type = __basic_common_ref<_Tp1, _Tp2>; };
4348 template<
typename _Tp1,
typename _Tp2>
4349 requires requires {
typename __cond_res<_Tp1, _Tp2>; }
4350 struct __common_reference_impl<_Tp1, _Tp2, 3>
4351 {
using type = __cond_res<_Tp1, _Tp2>; };
4354 template<
typename _Tp1,
typename _Tp2>
4356 struct __common_reference_impl<_Tp1, _Tp2, 4>
4357 {
using type = common_type_t<_Tp1, _Tp2>; };
4360 template<
typename _Tp1,
typename _Tp2>
4361 struct __common_reference_impl<_Tp1, _Tp2, 5>
4365 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4366 struct common_reference<_Tp1, _Tp2, _Rest...>
4367 : __common_type_fold<common_reference<_Tp1, _Tp2>,
4368 __common_type_pack<_Rest...>>
4372 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4373 struct __common_type_fold<common_reference<_Tp1, _Tp2>,
4374 __common_type_pack<_Rest...>,
4376 :
public common_reference<common_reference_t<_Tp1, _Tp2>, _Rest...>
4382#if __cplusplus >= 201103L
4385 template<
size_t... _Indexes>
struct _Index_tuple { };
4388 template<
size_t _Num>
4389 struct _Build_index_tuple
4391#if __has_builtin(__make_integer_seq)
4392 template<
typename,
size_t... _Indices>
4393 using _IdxTuple = _Index_tuple<_Indices...>;
4396 using __type = __make_integer_seq<_IdxTuple, size_t, _Num>;
4399 using __type = _Index_tuple<__integer_pack(_Num)...>;
4404#if __cpp_lib_within_lifetime >= 202306L
4405 template<
typename _Tp>
4407 is_within_lifetime(
const _Tp* __p)
noexcept
4408 {
return __builtin_is_within_lifetime (__p); }
4413_GLIBCXX_END_NAMESPACE_VERSION
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
static const size_t alignment_value
The value of the strictest alignment of _Types.
constexpr bool is_corresponding_member(_M1 _S1::*__m1, _M2 _S2::*__m2) noexcept
typename common_reference< _Tp... >::type common_reference_t
typename result_of< _Tp >::type result_of_t
Alias template for result_of.
typename aligned_storage< _S_len, alignment_value >::type type
The storage.
typename remove_extent< _Tp >::type remove_extent_t
Alias template for remove_extent.
typename conditional< _Cond, _Iftrue, _Iffalse >::type conditional_t
Alias template for conditional.
typename underlying_type< _Tp >::type underlying_type_t
Alias template for underlying_type.
typename make_signed< _Tp >::type make_signed_t
Alias template for make_signed.
typename add_lvalue_reference< _Tp >::type add_lvalue_reference_t
Alias template for add_lvalue_reference.
typename aligned_storage< _Len, _Align >::type aligned_storage_t
Alias template for aligned_storage.
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
typename add_pointer< _Tp >::type add_pointer_t
Alias template for add_pointer.
typename make_unsigned< _Tp >::type make_unsigned_t
Alias template for make_unsigned.
constexpr bool is_pointer_interconvertible_with_class(_Mem _Tp::*__mp) noexcept
True if __mp points to the first member of a standard-layout type.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
typename remove_all_extents< _Tp >::type remove_all_extents_t
Alias template for remove_all_extents.
typename remove_pointer< _Tp >::type remove_pointer_t
Alias template for remove_pointer.
typename add_rvalue_reference< _Tp >::type add_rvalue_reference_t
Alias template for add_rvalue_reference.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
constexpr bool is_layout_compatible_v
constexpr bool is_pointer_interconvertible_base_of_v
typename decay< _Tp >::type decay_t
Alias template for decay.
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.
Implementation details not part of the namespace std interface.
Primary class template for reference_wrapper.
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.