29 #ifndef _GLIBCXX_TYPE_TRAITS
30 #define _GLIBCXX_TYPE_TRAITS 1
32 #ifdef _GLIBCXX_SYSHDR
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_constant_wrapper
46 #define __glibcxx_want_has_unique_object_representations
47 #define __glibcxx_want_integral_constant_callable
48 #define __glibcxx_want_is_aggregate
49 #define __glibcxx_want_is_constant_evaluated
50 #define __glibcxx_want_is_final
51 #define __glibcxx_want_is_implicit_lifetime
52 #define __glibcxx_want_is_invocable
53 #define __glibcxx_want_is_layout_compatible
54 #define __glibcxx_want_is_nothrow_convertible
55 #define __glibcxx_want_is_null_pointer
56 #define __glibcxx_want_is_pointer_interconvertible
57 #define __glibcxx_want_is_scoped_enum
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
73 namespace std _GLIBCXX_VISIBILITY(default)
75 _GLIBCXX_BEGIN_NAMESPACE_VERSION
77 template<
typename _Tp>
94 template<
typename _Tp, _Tp __v>
97 static constexpr _Tp value = __v;
98 using value_type = _Tp;
100 constexpr
operator value_type()
const noexcept {
return value; }
102 #ifdef __cpp_lib_integral_constant_callable // C++ >= 14
103 constexpr value_type operator()()
const noexcept {
return value; }
107 #if ! __cpp_inline_variables
108 template<
typename _Tp, _Tp __v>
124 #ifdef __cpp_lib_bool_constant // C++ >= 17
128 using bool_constant = __bool_constant<__v>;
135 template<
bool,
typename _Tp =
void>
140 template<
typename _Tp>
142 {
using type = _Tp; };
145 template<
bool _Cond,
typename _Tp =
void>
146 using __enable_if_t =
typename enable_if<_Cond, _Tp>::type;
151 template<
typename _Tp,
typename>
156 struct __conditional<false>
158 template<
typename,
typename _Up>
163 template<
bool _Cond,
typename _If,
typename _Else>
164 using __conditional_t
165 =
typename __conditional<_Cond>::template type<_If, _Else>;
168 template <
typename _Type>
169 struct __type_identity
170 {
using type = _Type; };
172 template<
typename _Tp>
173 using __type_identity_t =
typename __type_identity<_Tp>::type;
178 template<
typename _Tp,
typename...>
179 using __first_t = _Tp;
182 template<
typename... _Bn>
184 __enable_if_t<!bool(_Bn::value)>...>;
186 template<
typename... _Bn>
189 template<
typename... _Bn>
190 auto __and_fn(
int) -> __first_t<
true_type,
191 __enable_if_t<bool(_Bn::value)>...>;
193 template<
typename... _Bn>
200 template<
typename... _Bn>
202 : decltype(__detail::__or_fn<_Bn...>(0))
205 template<
typename... _Bn>
207 : decltype(__detail::__and_fn<_Bn...>(0))
210 template<
typename _Pp>
212 : __bool_constant<!bool(_Pp::value)>
216 #ifdef __cpp_lib_logical_traits // C++ >= 17
219 template<
typename... _Bn>
220 inline constexpr
bool __or_v = __or_<_Bn...>::value;
221 template<
typename... _Bn>
222 inline constexpr
bool __and_v = __and_<_Bn...>::value;
226 template<
typename ,
typename _B1,
typename... _Bn>
227 struct __disjunction_impl
228 {
using type = _B1; };
230 template<
typename _B1,
typename _B2,
typename... _Bn>
231 struct __disjunction_impl<__enable_if_t<!bool(_B1::value)>, _B1, _B2, _Bn...>
232 {
using type =
typename __disjunction_impl<void, _B2, _Bn...>::type; };
234 template<
typename ,
typename _B1,
typename... _Bn>
235 struct __conjunction_impl
236 {
using type = _B1; };
238 template<
typename _B1,
typename _B2,
typename... _Bn>
239 struct __conjunction_impl<__enable_if_t<bool(_B1::value)>, _B1, _B2, _Bn...>
240 {
using type =
typename __conjunction_impl<void, _B2, _Bn...>::type; };
244 template<
typename... _Bn>
246 : __detail::__conjunction_impl<void, _Bn...>::type
254 template<
typename... _Bn>
256 : __detail::__disjunction_impl<void, _Bn...>::type
264 template<
typename _Pp>
272 template<
typename... _Bn>
273 inline constexpr
bool conjunction_v = conjunction<_Bn...>::value;
275 template<
typename... _Bn>
276 inline constexpr
bool disjunction_v = disjunction<_Bn...>::value;
278 template<
typename _Pp>
279 inline constexpr
bool negation_v = negation<_Pp>::value;
282 #endif // __cpp_lib_logical_traits
294 struct __is_array_unknown_bounds;
299 template<
typename _Tp>
300 using __maybe_complete_object_type
301 = __and_<is_object<_Tp>, __not_<__is_array_unknown_bounds<_Tp>>>;
307 template<
typename _Tp,
308 typename = __enable_if_t<__maybe_complete_object_type<_Tp>::value>,
309 size_t =
sizeof(_Tp)>
311 __is_complete_or_unbounded(__type_identity<_Tp>)
316 template<
typename _TypeIdentity,
317 typename _NestedType =
typename _TypeIdentity::type>
318 constexpr
typename __not_<__maybe_complete_object_type<_NestedType>>::type
319 __is_complete_or_unbounded(_TypeIdentity)
323 template<
typename _Tp>
324 using __remove_cv_t =
typename remove_cv<_Tp>::type;
330 template<
typename _Tp>
339 struct is_void<const void>
343 struct is_void<volatile void>
347 struct is_void<const volatile void>
356 enum class _Integer_kind { _None, _Signed, _Unsigned };
359 struct __is_integral_helper
361 {
static constexpr
auto _S_kind = _Integer_kind::_None; };
364 struct __is_integral_helper<bool>
366 {
static constexpr
auto _S_kind = _Integer_kind::_None; };
369 struct __is_integral_helper<char>
371 {
static constexpr
auto _S_kind = _Integer_kind::_None; };
374 struct __is_integral_helper<signed char>
376 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
379 struct __is_integral_helper<unsigned char>
381 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
387 struct __is_integral_helper<wchar_t>
389 {
static constexpr
auto _S_kind = _Integer_kind::_None; };
391 #ifdef _GLIBCXX_USE_CHAR8_T
393 struct __is_integral_helper<char8_t>
395 {
static constexpr
auto _S_kind = _Integer_kind::_None; };
399 struct __is_integral_helper<char16_t>
401 {
static constexpr
auto _S_kind = _Integer_kind::_None; };
404 struct __is_integral_helper<char32_t>
406 {
static constexpr
auto _S_kind = _Integer_kind::_None; };
409 struct __is_integral_helper<short>
411 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
414 struct __is_integral_helper<unsigned short>
416 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
419 struct __is_integral_helper<int>
421 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
424 struct __is_integral_helper<unsigned int>
426 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
429 struct __is_integral_helper<long>
431 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
434 struct __is_integral_helper<unsigned long>
436 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
439 struct __is_integral_helper<long long>
441 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
444 struct __is_integral_helper<unsigned long long>
446 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
450 #if defined(__GLIBCXX_TYPE_INT_N_0)
453 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
455 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
459 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
461 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
463 #if defined(__GLIBCXX_TYPE_INT_N_1)
466 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
468 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
472 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
474 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
476 #if defined(__GLIBCXX_TYPE_INT_N_2)
479 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
481 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
485 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
487 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
489 #if defined(__GLIBCXX_TYPE_INT_N_3)
492 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
494 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
498 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
500 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
503 #if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
506 struct __is_integral_helper<__int128>
508 {
static constexpr
auto _S_kind = _Integer_kind::_Signed; };
512 struct __is_integral_helper<unsigned __int128>
514 {
static constexpr
auto _S_kind = _Integer_kind::_Unsigned; };
518 template<
typename _Tp>
519 using __is_signed_integer
520 = __bool_constant<__is_integral_helper<_Tp>::_S_kind
521 == _Integer_kind::_Signed>;
524 template<
typename _Tp>
525 using __is_unsigned_integer
526 = __bool_constant<__is_integral_helper<_Tp>::_S_kind
527 == _Integer_kind::_Unsigned>;
531 template<
typename _Tp>
532 using __is_signed_or_unsigned_integer
533 = __bool_constant<__is_integral_helper<_Tp>::_S_kind
534 != _Integer_kind::_None>;
539 template<
typename _Tp>
541 :
public __is_integral_helper<__remove_cv_t<_Tp>>::type
546 struct __is_floating_point_helper
550 struct __is_floating_point_helper<float>
554 struct __is_floating_point_helper<double>
558 struct __is_floating_point_helper<long double>
561 #ifdef __STDCPP_FLOAT16_T__
563 struct __is_floating_point_helper<_Float16>
567 #ifdef __STDCPP_FLOAT32_T__
569 struct __is_floating_point_helper<_Float32>
573 #ifdef __STDCPP_FLOAT64_T__
575 struct __is_floating_point_helper<_Float64>
579 #ifdef __STDCPP_FLOAT128_T__
581 struct __is_floating_point_helper<_Float128>
585 #ifdef __STDCPP_BFLOAT16_T__
587 struct __is_floating_point_helper<
__gnu_cxx::__bfloat16_t>
591 #if defined(_GLIBCXX_USE_FLOAT128) && !defined(__CUDACC__)
593 struct __is_floating_point_helper<__float128>
599 template<
typename _Tp>
601 :
public __is_floating_point_helper<__remove_cv_t<_Tp>>::type
605 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
606 template<
typename _Tp>
608 :
public __bool_constant<__is_array(_Tp)>
615 template<
typename _Tp, std::
size_t _Size>
616 struct is_array<_Tp[_Size]>
619 template<
typename _Tp>
620 struct is_array<_Tp[]>
625 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
626 template<
typename _Tp>
628 :
public __bool_constant<__is_pointer(_Tp)>
631 template<
typename _Tp>
635 template<
typename _Tp>
636 struct is_pointer<_Tp*>
639 template<
typename _Tp>
640 struct is_pointer<_Tp*
const>
643 template<
typename _Tp>
644 struct is_pointer<_Tp*
volatile>
647 template<
typename _Tp>
648 struct is_pointer<_Tp*
const volatile>
657 template<
typename _Tp>
666 template<
typename _Tp>
671 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
672 template<
typename _Tp>
674 :
public __bool_constant<__is_member_object_pointer(_Tp)>
677 template<
typename _Tp>
681 struct __is_member_object_pointer_helper
684 template<
typename _Tp,
typename _Cp>
685 struct __is_member_object_pointer_helper<_Tp _Cp::*>
686 :
public __not_<is_function<_Tp>>::type { };
689 template<
typename _Tp>
690 struct is_member_object_pointer
691 :
public __is_member_object_pointer_helper<__remove_cv_t<_Tp>>::type
695 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
697 template<
typename _Tp>
699 :
public __bool_constant<__is_member_function_pointer(_Tp)>
702 template<
typename _Tp>
706 struct __is_member_function_pointer_helper
709 template<
typename _Tp,
typename _Cp>
710 struct __is_member_function_pointer_helper<_Tp _Cp::*>
711 :
public is_function<_Tp>::type { };
714 template<
typename _Tp>
715 struct is_member_function_pointer
716 :
public __is_member_function_pointer_helper<__remove_cv_t<_Tp>>::type
721 template<
typename _Tp>
723 :
public __bool_constant<__is_enum(_Tp)>
727 template<
typename _Tp>
729 :
public __bool_constant<__is_union(_Tp)>
733 template<
typename _Tp>
735 :
public __bool_constant<__is_class(_Tp)>
739 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
740 template<
typename _Tp>
742 :
public __bool_constant<__is_function(_Tp)>
745 template<
typename _Tp>
747 :
public __bool_constant<!is_const<const _Tp>::value> { };
749 template<
typename _Tp>
750 struct is_function<_Tp&>
753 template<
typename _Tp>
754 struct is_function<_Tp&&>
758 #if __cpp_impl_reflection >= 202506L // C++ >= 26
760 template<
typename _Tp>
765 struct is_reflection<decltype(^^int)>
769 struct is_reflection<const decltype(^^int)>
773 struct is_reflection<volatile decltype(^^int)>
777 struct is_reflection<const volatile decltype(^^int)>
781 #ifdef __cpp_lib_is_null_pointer // C++ >= 11
783 template<
typename _Tp>
784 struct is_null_pointer
788 struct is_null_pointer<
std::nullptr_t>
792 struct is_null_pointer<const
std::nullptr_t>
796 struct is_null_pointer<volatile
std::nullptr_t>
800 struct is_null_pointer<const volatile
std::nullptr_t>
805 template<
typename _Tp>
806 struct __is_nullptr_t
807 :
public is_null_pointer<_Tp>
808 { } _GLIBCXX_DEPRECATED_SUGGEST(
"std::is_null_pointer");
809 #endif // __cpp_lib_is_null_pointer
814 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
815 template<
typename _Tp>
817 :
public __bool_constant<__is_reference(_Tp)>
820 template<
typename _Tp>
825 template<
typename _Tp>
826 struct is_reference<_Tp&>
830 template<
typename _Tp>
831 struct is_reference<_Tp&&>
837 template<
typename _Tp>
839 :
public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
843 template<
typename _Tp>
845 :
public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
847 #if __cpp_impl_reflection >= 202506L
854 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
855 template<
typename _Tp>
857 :
public __bool_constant<__is_object(_Tp)>
860 template<
typename _Tp>
862 :
public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
871 template<
typename _Tp>
873 :
public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
874 is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
878 template<
typename _Tp>
880 :
public __bool_constant<!is_fundamental<_Tp>::value> { };
883 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
884 template<
typename _Tp>
886 :
public __bool_constant<__is_member_pointer(_Tp)>
890 template<
typename _Tp>
891 struct __is_member_pointer_helper
894 template<
typename _Tp,
typename _Cp>
895 struct __is_member_pointer_helper<_Tp _Cp::*>
899 template<
typename _Tp>
900 struct is_member_pointer
901 :
public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type
905 template<
typename,
typename>
909 template<
typename _Tp,
typename... _Types>
910 using __is_one_of = __or_<is_same<_Tp, _Types>...>;
913 template<
typename...>
using __void_t = void;
919 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
920 template<
typename _Tp>
922 :
public __bool_constant<__is_const(_Tp)>
929 template<
typename _Tp>
930 struct is_const<_Tp const>
935 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
936 template<
typename _Tp>
938 :
public __bool_constant<__is_volatile(_Tp)>
945 template<
typename _Tp>
946 struct is_volatile<_Tp volatile>
957 template<
typename _Tp>
959 _GLIBCXX26_DEPRECATED_SUGGEST(
"is_trivially_default_constructible && is_trivially_copyable")
961 : public __bool_constant<__is_trivial(_Tp)>
963 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
964 "template argument must be a complete class or an unbounded array");
968 template<
typename _Tp>
970 :
public __bool_constant<__is_trivially_copyable(_Tp)>
972 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
973 "template argument must be a complete class or an unbounded array");
977 template<
typename _Tp>
979 :
public __bool_constant<__is_standard_layout(_Tp)>
981 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
982 "template argument must be a complete class or an unbounded array");
990 template<
typename _Tp>
992 _GLIBCXX20_DEPRECATED_SUGGEST(
"is_standard_layout && is_trivial")
994 : public __bool_constant<__is_pod(_Tp)>
996 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
997 "template argument must be a complete class or an unbounded array");
1004 template<
typename _Tp>
1006 _GLIBCXX17_DEPRECATED
1008 :
public __bool_constant<__is_literal_type(_Tp)>
1010 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1011 "template argument must be a complete class or an unbounded array");
1015 template<
typename _Tp>
1017 :
public __bool_constant<__is_empty(_Tp)>
1021 template<
typename _Tp>
1023 :
public __bool_constant<__is_polymorphic(_Tp)>
1026 #ifdef __cpp_lib_is_final // C++ >= 14
1029 template<
typename _Tp>
1031 :
public __bool_constant<__is_final(_Tp)>
1036 template<
typename _Tp>
1038 :
public __bool_constant<__is_abstract(_Tp)>
1042 template<
typename _Tp,
1044 struct __is_signed_helper
1047 template<
typename _Tp>
1048 struct __is_signed_helper<_Tp, true>
1049 :
public __bool_constant<_Tp(-1) < _Tp(0)>
1054 template<typename _Tp>
1056 : public __is_signed_helper<_Tp>::type
1060 template<typename _Tp>
1062 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
1066 template<typename _Tp, typename _Up = _Tp&&>
1070 template<typename _Tp>
1075 template<typename _Tp>
1076 auto declval() noexcept -> decltype(__declval<_Tp>(0));
1082 template<typename _Tp>
1083 struct __is_array_known_bounds
1087 template<
typename _Tp,
size_t _Size>
1088 struct __is_array_known_bounds<_Tp[_Size]>
1092 template<
typename _Tp>
1093 struct __is_array_unknown_bounds
1097 template<
typename _Tp>
1098 struct __is_array_unknown_bounds<_Tp[]>
1105 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_destructible)
1107 template<
typename _Tp>
1109 :
public __bool_constant<__is_destructible(_Tp)>
1119 struct __do_is_destructible_impl
1121 template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
1128 template<
typename _Tp>
1129 struct __is_destructible_impl
1130 :
public __do_is_destructible_impl
1132 using type = decltype(__test<_Tp>(0));
1135 template<
typename _Tp,
1136 bool = __or_<is_void<_Tp>,
1137 __is_array_unknown_bounds<_Tp>,
1138 is_function<_Tp>>::value,
1139 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1140 struct __is_destructible_safe;
1142 template<
typename _Tp>
1143 struct __is_destructible_safe<_Tp, false, false>
1144 :
public __is_destructible_impl<typename
1145 remove_all_extents<_Tp>::type>::type
1148 template<
typename _Tp>
1149 struct __is_destructible_safe<_Tp, true, false>
1152 template<
typename _Tp>
1153 struct __is_destructible_safe<_Tp, false, true>
1158 template<
typename _Tp>
1159 struct is_destructible
1160 :
public __is_destructible_safe<_Tp>::type
1162 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1163 "template argument must be a complete class or an unbounded array");
1167 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_destructible)
1169 template<
typename _Tp>
1171 :
public __bool_constant<__is_nothrow_destructible(_Tp)>
1180 struct __do_is_nt_destructible_impl
1182 template<
typename _Tp>
1183 static __bool_constant<noexcept(declval<_Tp&>().~_Tp())>
1190 template<
typename _Tp>
1191 struct __is_nt_destructible_impl
1192 :
public __do_is_nt_destructible_impl
1194 using type = decltype(__test<_Tp>(0));
1197 template<
typename _Tp,
1198 bool = __or_<is_void<_Tp>,
1199 __is_array_unknown_bounds<_Tp>,
1200 is_function<_Tp>>::value,
1201 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1202 struct __is_nt_destructible_safe;
1204 template<
typename _Tp>
1205 struct __is_nt_destructible_safe<_Tp, false, false>
1206 :
public __is_nt_destructible_impl<typename
1207 remove_all_extents<_Tp>::type>::type
1210 template<
typename _Tp>
1211 struct __is_nt_destructible_safe<_Tp, true, false>
1214 template<
typename _Tp>
1215 struct __is_nt_destructible_safe<_Tp, false, true>
1220 template<
typename _Tp>
1221 struct is_nothrow_destructible
1222 :
public __is_nt_destructible_safe<_Tp>::type
1224 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1225 "template argument must be a complete class or an unbounded array");
1230 template<
typename _Tp,
typename... _Args>
1231 using __is_constructible_impl
1232 = __bool_constant<__is_constructible(_Tp, _Args...)>;
1236 template<
typename _Tp,
typename... _Args>
1238 :
public __is_constructible_impl<_Tp, _Args...>
1240 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1241 "template argument must be a complete class or an unbounded array");
1245 template<
typename _Tp>
1247 :
public __is_constructible_impl<_Tp>
1249 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1250 "template argument must be a complete class or an unbounded array");
1254 #if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference)
1255 template<
typename _Tp>
1256 using __add_lval_ref_t = __add_lvalue_reference(_Tp);
1258 template<
typename _Tp,
typename =
void>
1259 struct __add_lvalue_reference_helper
1260 {
using type = _Tp; };
1262 template<
typename _Tp>
1263 struct __add_lvalue_reference_helper<_Tp, __void_t<_Tp&>>
1264 {
using type = _Tp&; };
1266 template<
typename _Tp>
1267 using __add_lval_ref_t =
typename __add_lvalue_reference_helper<_Tp>::type;
1272 template<
typename _Tp>
1274 :
public __is_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1276 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1277 "template argument must be a complete class or an unbounded array");
1281 #if _GLIBCXX_USE_BUILTIN_TRAIT(__add_rvalue_reference)
1282 template<
typename _Tp>
1283 using __add_rval_ref_t = __add_rvalue_reference(_Tp);
1285 template<
typename _Tp,
typename =
void>
1286 struct __add_rvalue_reference_helper
1287 {
using type = _Tp; };
1289 template<
typename _Tp>
1290 struct __add_rvalue_reference_helper<_Tp, __void_t<_Tp&&>>
1291 {
using type = _Tp&&; };
1293 template<
typename _Tp>
1294 using __add_rval_ref_t =
typename __add_rvalue_reference_helper<_Tp>::type;
1299 template<
typename _Tp>
1301 :
public __is_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1303 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1304 "template argument must be a complete class or an unbounded array");
1308 template<
typename _Tp,
typename... _Args>
1309 using __is_nothrow_constructible_impl
1310 = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;
1314 template<
typename _Tp,
typename... _Args>
1316 :
public __is_nothrow_constructible_impl<_Tp, _Args...>
1318 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1319 "template argument must be a complete class or an unbounded array");
1323 template<
typename _Tp>
1325 :
public __is_nothrow_constructible_impl<_Tp>
1327 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1328 "template argument must be a complete class or an unbounded array");
1332 template<
typename _Tp>
1334 :
public __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1336 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1337 "template argument must be a complete class or an unbounded array");
1341 template<
typename _Tp>
1343 :
public __is_nothrow_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1345 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1346 "template argument must be a complete class or an unbounded array");
1350 template<
typename _Tp,
typename _Up>
1351 using __is_assignable_impl = __bool_constant<__is_assignable(_Tp, _Up)>;
1355 template<
typename _Tp,
typename _Up>
1357 :
public __is_assignable_impl<_Tp, _Up>
1359 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1360 "template argument must be a complete class or an unbounded array");
1364 template<
typename _Tp>
1366 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>,
1367 __add_lval_ref_t<const _Tp>>
1369 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1370 "template argument must be a complete class or an unbounded array");
1374 template<
typename _Tp>
1376 :
public __is_assignable_impl<__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>>
1378 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1379 "template argument must be a complete class or an unbounded array");
1383 template<
typename _Tp,
typename _Up>
1384 using __is_nothrow_assignable_impl
1385 = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>;
1389 template<
typename _Tp,
typename _Up>
1391 :
public __is_nothrow_assignable_impl<_Tp, _Up>
1393 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1394 "template argument must be a complete class or an unbounded array");
1398 template<
typename _Tp>
1400 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1401 __add_lval_ref_t<const _Tp>>
1403 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1404 "template argument must be a complete class or an unbounded array");
1408 template<
typename _Tp>
1410 :
public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1411 __add_rval_ref_t<_Tp>>
1413 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1414 "template argument must be a complete class or an unbounded array");
1418 template<
typename _Tp,
typename... _Args>
1419 using __is_trivially_constructible_impl
1420 = __bool_constant<__is_trivially_constructible(_Tp, _Args...)>;
1424 template<
typename _Tp,
typename... _Args>
1426 :
public __is_trivially_constructible_impl<_Tp, _Args...>
1428 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1429 "template argument must be a complete class or an unbounded array");
1433 template<
typename _Tp>
1435 :
public __is_trivially_constructible_impl<_Tp>
1437 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1438 "template argument must be a complete class or an unbounded array");
1441 #if __cpp_variable_templates && __cpp_concepts
1442 template<
typename _Tp>
1443 constexpr
bool __is_implicitly_default_constructible_v
1444 = requires (
void(&__f)(_Tp)) { __f({}); };
1446 template<
typename _Tp>
1447 struct __is_implicitly_default_constructible
1448 : __bool_constant<__is_implicitly_default_constructible_v<_Tp>>
1451 struct __do_is_implicitly_default_constructible_impl
1453 template <
typename _Tp>
1454 static void __helper(
const _Tp&);
1456 template <
typename _Tp>
1458 decltype(__helper<const _Tp&>({}))* = 0);
1463 template<
typename _Tp>
1464 struct __is_implicitly_default_constructible_impl
1465 :
public __do_is_implicitly_default_constructible_impl
1467 using type = decltype(__test(declval<_Tp>()));
1470 template<
typename _Tp>
1471 struct __is_implicitly_default_constructible_safe
1472 :
public __is_implicitly_default_constructible_impl<_Tp>::type
1475 template <
typename _Tp>
1476 struct __is_implicitly_default_constructible
1477 :
public __and_<__is_constructible_impl<_Tp>,
1478 __is_implicitly_default_constructible_safe<_Tp>>::type
1483 template<
typename _Tp>
1485 :
public __is_trivially_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1487 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1488 "template argument must be a complete class or an unbounded array");
1492 template<
typename _Tp>
1494 :
public __is_trivially_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1496 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1497 "template argument must be a complete class or an unbounded array");
1501 template<
typename _Tp,
typename _Up>
1502 using __is_trivially_assignable_impl
1503 = __bool_constant<__is_trivially_assignable(_Tp, _Up)>;
1507 template<
typename _Tp,
typename _Up>
1509 :
public __is_trivially_assignable_impl<_Tp, _Up>
1511 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1512 "template argument must be a complete class or an unbounded array");
1516 template<
typename _Tp>
1518 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1519 __add_lval_ref_t<const _Tp>>
1521 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1522 "template argument must be a complete class or an unbounded array");
1526 template<
typename _Tp>
1528 :
public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1529 __add_rval_ref_t<_Tp>>
1531 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1532 "template argument must be a complete class or an unbounded array");
1535 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_trivially_destructible)
1537 template<
typename _Tp>
1539 :
public __bool_constant<__is_trivially_destructible(_Tp)>
1543 template<
typename _Tp>
1545 :
public __and_<__is_destructible_safe<_Tp>,
1546 __bool_constant<__has_trivial_destructor(_Tp)>>::type
1548 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1549 "template argument must be a complete class or an unbounded array");
1554 template<
typename _Tp>
1556 :
public __bool_constant<__has_virtual_destructor(_Tp)>
1558 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1559 "template argument must be a complete class or an unbounded array");
1566 template<
typename _Tp>
1570 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1571 "template argument must be a complete class or an unbounded array");
1575 #if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) \
1576 && (!defined(__clang__) || __clang_major__ >= 20) // PR118559
1577 template<
typename _Tp>
1585 template<
typename _Tp, std::
size_t _Size>
1586 struct rank<_Tp[_Size]>
1587 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1589 template<
typename _Tp>
1591 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1595 template<
typename,
unsigned _U
int = 0>
1599 template<
typename _Tp,
size_t _Size>
1600 struct extent<_Tp[_Size], 0>
1603 template<
typename _Tp,
unsigned _U
int,
size_t _Size>
1604 struct extent<_Tp[_Size], _Uint>
1605 :
public extent<_Tp, _Uint - 1>::type { };
1607 template<
typename _Tp>
1608 struct extent<_Tp[], 0>
1609 :
public integral_constant<size_t, 0> { };
1611 template<
typename _Tp,
unsigned _U
int>
1612 struct extent<_Tp[], _Uint>
1613 :
public extent<_Tp, _Uint - 1>::type { };
1619 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
1620 template<
typename _Tp,
typename _Up>
1622 :
public __bool_constant<__is_same(_Tp, _Up)>
1625 template<
typename _Tp,
typename _Up>
1630 template<
typename _Tp>
1631 struct is_same<_Tp, _Tp>
1637 template<
typename _Base,
typename _Derived>
1639 :
public __bool_constant<__is_base_of(_Base, _Derived)>
1642 #ifdef __cpp_lib_is_virtual_base_of // C++ >= 26
1645 template<
typename _Base,
typename _Derived>
1646 struct is_virtual_base_of
1647 :
public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)>
1651 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
1652 template<
typename _From,
typename _To>
1653 struct is_convertible
1654 :
public __bool_constant<__is_convertible(_From, _To)>
1657 template<
typename _From,
typename _To,
1658 bool = __or_<is_void<_From>, is_function<_To>,
1659 is_array<_To>>::value>
1660 struct __is_convertible_helper
1662 using type =
typename is_void<_To>::type;
1665 #pragma GCC diagnostic push
1666 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1667 template<
typename _From,
typename _To>
1668 class __is_convertible_helper<_From, _To, false>
1670 template<
typename _To1>
1671 static void __test_aux(_To1) noexcept;
1673 template<
typename _From1,
typename _To1,
1674 typename = decltype(__test_aux<_To1>(std::declval<_From1>()))>
1678 template<
typename,
typename>
1683 using type = decltype(__test<_From, _To>(0));
1685 #pragma GCC diagnostic pop
1688 template<
typename _From,
typename _To>
1689 struct is_convertible
1690 :
public __is_convertible_helper<_From, _To>::type
1695 template<
typename _ToElementType,
typename _FromElementType>
1696 using __is_array_convertible
1697 = is_convertible<_FromElementType(*)[], _ToElementType(*)[]>;
1699 #ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
1701 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
1703 template<
typename _From,
typename _To>
1704 inline constexpr
bool is_nothrow_convertible_v
1705 = __is_nothrow_convertible(_From, _To);
1708 template<
typename _From,
typename _To>
1709 struct is_nothrow_convertible
1710 :
public bool_constant<is_nothrow_convertible_v<_From, _To>>
1713 template<
typename _From,
typename _To,
1714 bool = __or_<is_void<_From>, is_function<_To>,
1715 is_array<_To>>::value>
1716 struct __is_nt_convertible_helper
1720 #pragma GCC diagnostic push
1721 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1722 template<
typename _From,
typename _To>
1723 class __is_nt_convertible_helper<_From, _To, false>
1725 template<
typename _To1>
1726 static void __test_aux(_To1) noexcept;
1728 template<
typename _From1,
typename _To1>
1730 __bool_constant<noexcept(__test_aux<_To1>(std::declval<_From1>()))>
1733 template<
typename,
typename>
1738 using type = decltype(__test<_From, _To>(0));
1740 #pragma GCC diagnostic pop
1743 template<
typename _From,
typename _To>
1744 struct is_nothrow_convertible
1745 :
public __is_nt_convertible_helper<_From, _To>::type
1749 template<
typename _From,
typename _To>
1750 inline constexpr
bool is_nothrow_convertible_v
1751 = is_nothrow_convertible<_From, _To>::value;
1753 #endif // __cpp_lib_is_nothrow_convertible
1755 #pragma GCC diagnostic push
1756 #pragma GCC diagnostic ignored "-Wc++14-extensions" // for variable templates
1757 template<
typename _Tp,
typename... _Args>
1758 struct __is_nothrow_new_constructible_impl
1760 noexcept(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))
1764 template<
typename _Tp,
typename... _Args>
1765 _GLIBCXX17_INLINE constexpr
bool __is_nothrow_new_constructible
1766 = __and_<is_constructible<_Tp, _Args...>,
1767 __is_nothrow_new_constructible_impl<_Tp, _Args...>>::value;
1768 #pragma GCC diagnostic pop
1773 template<
typename _Tp>
1775 {
using type = _Tp; };
1777 template<
typename _Tp>
1779 {
using type = _Tp; };
1782 template<
typename _Tp>
1784 {
using type = _Tp; };
1786 template<
typename _Tp>
1788 {
using type = _Tp; };
1791 #if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
1792 template<
typename _Tp>
1794 {
using type = __remove_cv(_Tp); };
1796 template<
typename _Tp>
1798 {
using type = _Tp; };
1800 template<
typename _Tp>
1801 struct remove_cv<const _Tp>
1802 {
using type = _Tp; };
1804 template<
typename _Tp>
1805 struct remove_cv<volatile _Tp>
1806 {
using type = _Tp; };
1808 template<
typename _Tp>
1809 struct remove_cv<const volatile _Tp>
1810 {
using type = _Tp; };
1814 template<
typename _Tp>
1816 {
using type = _Tp
const; };
1819 template<
typename _Tp>
1821 {
using type = _Tp
volatile; };
1824 template<
typename _Tp>
1826 {
using type = _Tp
const volatile; };
1828 #ifdef __cpp_lib_transformation_trait_aliases // C++ >= 14
1830 template<
typename _Tp>
1831 using remove_const_t =
typename remove_const<_Tp>::type;
1834 template<
typename _Tp>
1835 using remove_volatile_t =
typename remove_volatile<_Tp>::type;
1838 template<
typename _Tp>
1839 using remove_cv_t =
typename remove_cv<_Tp>::type;
1842 template<
typename _Tp>
1843 using add_const_t =
typename add_const<_Tp>::type;
1846 template<
typename _Tp>
1847 using add_volatile_t =
typename add_volatile<_Tp>::type;
1850 template<
typename _Tp>
1851 using add_cv_t =
typename add_cv<_Tp>::type;
1857 #if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
1858 template<
typename _Tp>
1860 {
using type = __remove_reference(_Tp); };
1862 template<
typename _Tp>
1864 {
using type = _Tp; };
1866 template<
typename _Tp>
1867 struct remove_reference<_Tp&>
1868 {
using type = _Tp; };
1870 template<
typename _Tp>
1871 struct remove_reference<_Tp&&>
1872 {
using type = _Tp; };
1876 template<
typename _Tp>
1878 {
using type = __add_lval_ref_t<_Tp>; };
1881 template<
typename _Tp>
1883 {
using type = __add_rval_ref_t<_Tp>; };
1885 #if __cplusplus > 201103L
1887 template<
typename _Tp>
1891 template<
typename _Tp>
1895 template<
typename _Tp>
1904 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1905 struct __cv_selector;
1907 template<
typename _Unqualified>
1908 struct __cv_selector<_Unqualified, false, false>
1909 {
using __type = _Unqualified; };
1911 template<
typename _Unqualified>
1912 struct __cv_selector<_Unqualified, false, true>
1913 {
using __type =
volatile _Unqualified; };
1915 template<
typename _Unqualified>
1916 struct __cv_selector<_Unqualified, true, false>
1917 {
using __type =
const _Unqualified; };
1919 template<
typename _Unqualified>
1920 struct __cv_selector<_Unqualified, true, true>
1921 {
using __type =
const volatile _Unqualified; };
1923 template<
typename _Qualified,
typename _Unqualified,
1924 bool _IsConst = is_const<_Qualified>::value,
1925 bool _IsVol = is_volatile<_Qualified>::value>
1926 class __match_cv_qualifiers
1928 using __match = __cv_selector<_Unqualified, _IsConst, _IsVol>;
1931 using __type =
typename __match::__type;
1935 template<
typename _Tp>
1936 struct __make_unsigned
1937 {
using __type = _Tp; };
1940 struct __make_unsigned<char>
1941 {
using __type =
unsigned char; };
1944 struct __make_unsigned<signed char>
1945 {
using __type =
unsigned char; };
1948 struct __make_unsigned<short>
1949 {
using __type =
unsigned short; };
1952 struct __make_unsigned<int>
1953 {
using __type =
unsigned int; };
1956 struct __make_unsigned<long>
1957 {
using __type =
unsigned long; };
1960 struct __make_unsigned<long long>
1961 {
using __type =
unsigned long long; };
1963 #if defined(__GLIBCXX_TYPE_INT_N_0)
1966 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1967 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_0; };
1969 #if defined(__GLIBCXX_TYPE_INT_N_1)
1972 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
1973 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_1; };
1975 #if defined(__GLIBCXX_TYPE_INT_N_2)
1978 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
1979 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_2; };
1981 #if defined(__GLIBCXX_TYPE_INT_N_3)
1984 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
1985 {
using __type =
unsigned __GLIBCXX_TYPE_INT_N_3; };
1987 #if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
1990 struct __make_unsigned<__int128>
1991 {
using __type =
unsigned __int128; };
1995 template<
typename _Tp,
1996 bool _IsInt = is_integral<_Tp>::value,
1997 bool _IsEnum = __is_enum(_Tp)>
1998 class __make_unsigned_selector;
2000 template<
typename _Tp>
2001 class __make_unsigned_selector<_Tp, true, false>
2003 using __unsigned_type
2004 =
typename __make_unsigned<__remove_cv_t<_Tp>>::__type;
2008 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
2011 class __make_unsigned_selector_base
2014 template<
typename...>
struct _List { };
2016 template<
typename _Tp,
typename... _Up>
2017 struct _List<_Tp, _Up...> : _List<_Up...>
2018 {
static constexpr
size_t __size =
sizeof(_Tp); };
2020 template<
size_t _Sz,
typename _Tp,
bool = (_Sz <= _Tp::__size)>
2023 template<
size_t _Sz,
typename _U
int,
typename... _UInts>
2024 struct __select<_Sz, _List<_Uint, _UInts...>,
true>
2025 {
using __type = _Uint; };
2027 template<
size_t _Sz,
typename _Uint,
typename... _UInts>
2028 struct __select<_Sz, _List<_Uint, _UInts...>, false>
2029 : __select<_Sz, _List<_UInts...>>
2034 template<
typename _Tp>
2035 class __make_unsigned_selector<_Tp, false, true>
2036 : __make_unsigned_selector_base
2040 using _UInts = _List<
unsigned char,
unsigned short,
unsigned int,
2041 unsigned long,
unsigned long long
2042 #ifdef __SIZEOF_INT128__
2047 using __unsigned_type =
typename __select<
sizeof(_Tp), _UInts>::__type;
2051 =
typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
2059 struct __make_unsigned<wchar_t>
2062 =
typename __make_unsigned_selector<wchar_t, false, true>::__type;
2065 #ifdef _GLIBCXX_USE_CHAR8_T
2067 struct __make_unsigned<char8_t>
2070 =
typename __make_unsigned_selector<char8_t, false, true>::__type;
2075 struct __make_unsigned<char16_t>
2078 =
typename __make_unsigned_selector<char16_t, false, true>::__type;
2082 struct __make_unsigned<char32_t>
2085 =
typename __make_unsigned_selector<char32_t, false, true>::__type;
2093 template<
typename _Tp>
2095 {
using type =
typename __make_unsigned_selector<_Tp>::__type; };
2106 template<
typename _Tp>
2107 struct __make_signed
2108 {
using __type = _Tp; };
2111 struct __make_signed<char>
2112 {
using __type =
signed char; };
2115 struct __make_signed<unsigned char>
2116 {
using __type =
signed char; };
2119 struct __make_signed<unsigned short>
2120 {
using __type =
signed short; };
2123 struct __make_signed<unsigned int>
2124 {
using __type =
signed int; };
2127 struct __make_signed<unsigned long>
2128 {
using __type =
signed long; };
2131 struct __make_signed<unsigned long long>
2132 {
using __type =
signed long long; };
2134 #if defined(__GLIBCXX_TYPE_INT_N_0)
2137 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
2138 {
using __type = __GLIBCXX_TYPE_INT_N_0; };
2140 #if defined(__GLIBCXX_TYPE_INT_N_1)
2143 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
2144 {
using __type = __GLIBCXX_TYPE_INT_N_1; };
2146 #if defined(__GLIBCXX_TYPE_INT_N_2)
2149 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
2150 {
using __type = __GLIBCXX_TYPE_INT_N_2; };
2152 #if defined(__GLIBCXX_TYPE_INT_N_3)
2155 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
2156 {
using __type = __GLIBCXX_TYPE_INT_N_3; };
2158 #if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
2161 struct __make_signed<unsigned __int128>
2162 {
using __type = __int128; };
2166 template<
typename _Tp,
2167 bool _IsInt = is_integral<_Tp>::value,
2168 bool _IsEnum = __is_enum(_Tp)>
2169 class __make_signed_selector;
2171 template<
typename _Tp>
2172 class __make_signed_selector<_Tp, true, false>
2175 =
typename __make_signed<__remove_cv_t<_Tp>>::__type;
2179 =
typename __match_cv_qualifiers<_Tp, __signed_type>::__type;
2183 template<
typename _Tp>
2184 class __make_signed_selector<_Tp, false, true>
2186 using __unsigned_type =
typename __make_unsigned_selector<_Tp>::__type;
2189 using __type =
typename __make_signed_selector<__unsigned_type>::__type;
2197 struct __make_signed<wchar_t>
2200 =
typename __make_signed_selector<wchar_t, false, true>::__type;
2203 #if defined(_GLIBCXX_USE_CHAR8_T)
2205 struct __make_signed<char8_t>
2208 =
typename __make_signed_selector<char8_t, false, true>::__type;
2213 struct __make_signed<char16_t>
2216 =
typename __make_signed_selector<char16_t, false, true>::__type;
2220 struct __make_signed<char32_t>
2223 =
typename __make_signed_selector<char32_t, false, true>::__type;
2231 template<
typename _Tp>
2233 {
using type =
typename __make_signed_selector<_Tp>::__type; };
2239 template<>
struct make_signed<bool const volatile>;
2241 #if __cplusplus > 201103L
2243 template<
typename _Tp>
2247 template<
typename _Tp>
2254 #if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_extent)
2255 template<
typename _Tp>
2257 {
using type = __remove_extent(_Tp); };
2259 template<
typename _Tp>
2261 {
using type = _Tp; };
2263 template<
typename _Tp, std::
size_t _Size>
2264 struct remove_extent<_Tp[_Size]>
2265 {
using type = _Tp; };
2267 template<
typename _Tp>
2268 struct remove_extent<_Tp[]>
2269 {
using type = _Tp; };
2273 #if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
2274 template<
typename _Tp>
2275 struct remove_all_extents
2276 {
using type = __remove_all_extents(_Tp); };
2278 template<
typename _Tp>
2279 struct remove_all_extents
2280 {
using type = _Tp; };
2282 template<
typename _Tp, std::
size_t _Size>
2283 struct remove_all_extents<_Tp[_Size]>
2284 {
using type =
typename remove_all_extents<_Tp>::type; };
2286 template<
typename _Tp>
2287 struct remove_all_extents<_Tp[]>
2288 {
using type =
typename remove_all_extents<_Tp>::type; };
2291 #if __cplusplus > 201103L
2293 template<
typename _Tp>
2297 template<
typename _Tp>
2304 #if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_pointer)
2305 template<
typename _Tp>
2307 {
using type = __remove_pointer(_Tp); };
2309 template<
typename _Tp,
typename>
2310 struct __remove_pointer_helper
2311 {
using type = _Tp; };
2313 template<
typename _Tp,
typename _Up>
2314 struct __remove_pointer_helper<_Tp, _Up*>
2315 {
using type = _Up; };
2317 template<
typename _Tp>
2318 struct remove_pointer
2319 :
public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>>
2324 #if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer)
2325 template<
typename _Tp>
2327 {
using type = __add_pointer(_Tp); };
2329 template<
typename _Tp,
typename =
void>
2330 struct __add_pointer_helper
2331 {
using type = _Tp; };
2333 template<
typename _Tp>
2334 struct __add_pointer_helper<_Tp, __void_t<_Tp*>>
2335 {
using type = _Tp*; };
2337 template<
typename _Tp>
2339 :
public __add_pointer_helper<_Tp>
2342 template<
typename _Tp>
2343 struct add_pointer<_Tp&>
2344 {
using type = _Tp*; };
2346 template<
typename _Tp>
2347 struct add_pointer<_Tp&&>
2348 {
using type = _Tp*; };
2351 #if __cplusplus > 201103L
2353 template<
typename _Tp>
2357 template<
typename _Tp>
2364 struct __attribute__((__aligned__)) __aligned_storage_max_align_t
2368 __aligned_storage_default_alignment([[__maybe_unused__]]
size_t __len)
2370 #if _GLIBCXX_INLINE_VERSION
2372 = integral_constant<size_t,
alignof(__aligned_storage_max_align_t)>;
2374 return __len > (_Max_align::value / 2)
2376 #
if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_clzg)
2377 : 1 << (__SIZE_WIDTH__ - __builtin_clzg(__len - 1u));
2379 : 1 << (__LLONG_WIDTH__ - __builtin_clzll(__len - 1ull));
2384 return alignof(__aligned_storage_max_align_t);
2420 template<
size_t _Len,
2421 size_t _Align = __aligned_storage_default_alignment(_Len)>
2423 _GLIBCXX23_DEPRECATED
2428 alignas(_Align)
unsigned char __data[_Len];
2432 template <
typename... _Types>
2433 struct __strictest_alignment
2435 static const size_t _S_alignment = 0;
2436 static const size_t _S_size = 0;
2439 template <
typename _Tp,
typename... _Types>
2440 struct __strictest_alignment<_Tp, _Types...>
2442 static const size_t _S_alignment =
2443 alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
2444 ?
alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
2445 static const size_t _S_size =
2446 sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
2447 ?
sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
2450 #pragma GCC diagnostic push
2451 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2465 template <
size_t _Len,
typename... _Types>
2467 _GLIBCXX23_DEPRECATED
2471 static_assert(
sizeof...(_Types) != 0,
"At least one type is required");
2473 using __strictest = __strictest_alignment<_Types...>;
2474 static const size_t _S_len = _Len > __strictest::_S_size
2475 ? _Len : __strictest::_S_size;
2478 static const size_t alignment_value = __strictest::_S_alignment;
2483 template <
size_t _Len,
typename... _Types>
2484 const size_t aligned_union<_Len, _Types...>::alignment_value;
2485 #pragma GCC diagnostic pop
2489 #if _GLIBCXX_USE_BUILTIN_TRAIT(__decay)
2490 template<
typename _Tp>
2492 {
using type = __decay(_Tp); };
2496 template<
typename _Up>
2497 struct __decay_selector
2498 : __conditional_t<is_const<const _Up>::value,
2503 template<
typename _Up,
size_t _Nm>
2504 struct __decay_selector<_Up[_Nm]>
2505 {
using type = _Up*; };
2507 template<
typename _Up>
2508 struct __decay_selector<_Up[]>
2509 {
using type = _Up*; };
2514 template<
typename _Tp>
2516 {
using type =
typename __decay_selector<_Tp>::type; };
2518 template<
typename _Tp>
2520 {
using type =
typename __decay_selector<_Tp>::type; };
2522 template<
typename _Tp>
2524 {
using type =
typename __decay_selector<_Tp>::type; };
2530 template<
typename _Tp>
2531 struct __strip_reference_wrapper
2536 template<
typename _Tp>
2537 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
2539 using __type = _Tp&;
2543 template<
typename _Tp>
2544 using __decay_t =
typename decay<_Tp>::type;
2546 template<
typename _Tp>
2547 using __decay_and_strip = __strip_reference_wrapper<__decay_t<_Tp>>;
2553 template<
typename... _Cond>
2554 using _Require = __enable_if_t<__and_<_Cond...>::value>;
2557 template<
typename _Tp>
2558 using __remove_cvref_t
2559 =
typename remove_cv<typename remove_reference<_Tp>::type>::type;
2564 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2566 {
using type = _Iftrue; };
2569 template<
typename _Iftrue,
typename _Iffalse>
2571 {
using type = _Iffalse; };
2574 template<
typename... _Tp>
2586 template<
typename _Tp>
2587 struct __success_type
2588 {
using type = _Tp; };
2590 struct __failure_type
2593 struct __do_common_type_impl
2595 template<
typename _Tp,
typename _Up>
2597 = decltype(
true ? std::declval<_Tp>() : std::declval<_Up>());
2601 template<
typename _Tp,
typename _Up>
2602 static __success_type<__decay_t<__cond_t<_Tp, _Up>>>
2605 #if __cplusplus > 201703L
2608 template<
typename _Tp,
typename _Up>
2609 static __success_type<__remove_cvref_t<__cond_t<const _Tp&, const _Up&>>>
2613 template<
typename,
typename>
2614 static __failure_type
2617 template<
typename _Tp,
typename _Up>
2618 static decltype(_S_test_2<_Tp, _Up>(0))
2624 struct common_type<>
2628 template<
typename _Tp0>
2629 struct common_type<_Tp0>
2630 :
public common_type<_Tp0, _Tp0>
2634 template<
typename _Tp1,
typename _Tp2,
2635 typename _Dp1 = __decay_t<_Tp1>,
typename _Dp2 = __decay_t<_Tp2>>
2636 struct __common_type_impl
2640 using type = common_type<_Dp1, _Dp2>;
2643 template<
typename _Tp1,
typename _Tp2>
2644 struct __common_type_impl<_Tp1, _Tp2, _Tp1, _Tp2>
2645 :
private __do_common_type_impl
2649 using type = decltype(_S_test<_Tp1, _Tp2>(0));
2653 template<
typename _Tp1,
typename _Tp2>
2654 struct common_type<_Tp1, _Tp2>
2655 :
public __common_type_impl<_Tp1, _Tp2>::type
2658 template<
typename...>
2659 struct __common_type_pack
2662 template<
typename,
typename,
typename =
void>
2663 struct __common_type_fold;
2666 template<
typename _Tp1,
typename _Tp2,
typename... _Rp>
2667 struct common_type<_Tp1, _Tp2, _Rp...>
2668 :
public __common_type_fold<common_type<_Tp1, _Tp2>,
2669 __common_type_pack<_Rp...>>
2675 template<
typename _CTp,
typename... _Rp>
2676 struct __common_type_fold<_CTp, __common_type_pack<_Rp...>,
2677 __void_t<typename _CTp::type>>
2678 :
public common_type<typename _CTp::type, _Rp...>
2682 template<
typename _CTp,
typename _Rp>
2683 struct __common_type_fold<_CTp, _Rp, void>
2686 template<
typename _Tp,
bool = __is_enum(_Tp)>
2687 struct __underlying_type_impl
2689 using type = __underlying_type(_Tp);
2692 template<
typename _Tp>
2693 struct __underlying_type_impl<_Tp, false>
2698 template<
typename _Tp>
2700 :
public __underlying_type_impl<_Tp>
2704 template<
typename _Tp>
2705 struct __declval_protector
2707 static const bool __stop =
false;
2715 template<
typename _Tp>
2716 auto declval() noexcept -> decltype(__declval<_Tp>(0))
2718 static_assert(__declval_protector<_Tp>::__stop,
2719 "declval() must not be used!");
2720 return __declval<_Tp>(0);
2724 template<
typename _Signature>
2730 struct __invoke_memfun_ref { };
2731 struct __invoke_memfun_deref { };
2732 struct __invoke_memobj_ref { };
2733 struct __invoke_memobj_deref { };
2734 struct __invoke_other { };
2737 template<
typename _Tp,
typename _Tag>
2738 struct __result_of_success : __success_type<_Tp>
2739 {
using __invoke_type = _Tag; };
2742 struct __result_of_memfun_ref_impl
2744 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2745 static __result_of_success<decltype(
2746 (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
2747 ), __invoke_memfun_ref> _S_test(
int);
2749 template<
typename...>
2750 static __failure_type _S_test(...);
2753 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2754 struct __result_of_memfun_ref
2755 :
private __result_of_memfun_ref_impl
2757 using type = decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2761 struct __result_of_memfun_deref_impl
2763 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2764 static __result_of_success<decltype(
2765 ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
2766 ), __invoke_memfun_deref> _S_test(
int);
2768 template<
typename...>
2769 static __failure_type _S_test(...);
2772 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2773 struct __result_of_memfun_deref
2774 :
private __result_of_memfun_deref_impl
2776 using type = decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2780 struct __result_of_memobj_ref_impl
2782 template<
typename _Fp,
typename _Tp1>
2783 static __result_of_success<decltype(
2784 std::declval<_Tp1>().*std::declval<_Fp>()
2785 ), __invoke_memobj_ref> _S_test(
int);
2787 template<
typename,
typename>
2788 static __failure_type _S_test(...);
2791 template<
typename _MemPtr,
typename _Arg>
2792 struct __result_of_memobj_ref
2793 :
private __result_of_memobj_ref_impl
2795 using type = decltype(_S_test<_MemPtr, _Arg>(0));
2799 struct __result_of_memobj_deref_impl
2801 template<
typename _Fp,
typename _Tp1>
2802 static __result_of_success<decltype(
2803 (*std::declval<_Tp1>()).*std::declval<_Fp>()
2804 ), __invoke_memobj_deref> _S_test(
int);
2806 template<
typename,
typename>
2807 static __failure_type _S_test(...);
2810 template<
typename _MemPtr,
typename _Arg>
2811 struct __result_of_memobj_deref
2812 :
private __result_of_memobj_deref_impl
2814 using type = decltype(_S_test<_MemPtr, _Arg>(0));
2817 template<
typename _MemPtr,
typename _Arg>
2818 struct __result_of_memobj;
2820 template<
typename _Res,
typename _Class,
typename _Arg>
2821 struct __result_of_memobj<_Res _Class::*, _Arg>
2823 using _Argval = __remove_cvref_t<_Arg>;
2824 using _MemPtr = _Res _Class::*;
2825 using type =
typename __conditional_t<__or_<is_same<_Argval, _Class>,
2826 is_base_of<_Class, _Argval>>::value,
2827 __result_of_memobj_ref<_MemPtr, _Arg>,
2828 __result_of_memobj_deref<_MemPtr, _Arg>
2832 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2833 struct __result_of_memfun;
2835 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2836 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2838 using _Argval =
typename remove_reference<_Arg>::type;
2839 using _MemPtr = _Res _Class::*;
2840 using type =
typename __conditional_t<is_base_of<_Class, _Argval>::value,
2841 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2842 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2851 template<
typename _Tp,
typename _Up = __remove_cvref_t<_Tp>>
2857 template<
typename _Tp,
typename _Up>
2858 struct __inv_unwrap<_Tp, reference_wrapper<_Up>>
2863 template<bool, bool,
typename _Functor,
typename... _ArgTypes>
2864 struct __result_of_impl
2866 using type = __failure_type;
2869 template<
typename _MemPtr,
typename _Arg>
2870 struct __result_of_impl<true, false, _MemPtr, _Arg>
2871 :
public __result_of_memobj<__decay_t<_MemPtr>,
2872 typename __inv_unwrap<_Arg>::type>
2875 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2876 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2877 :
public __result_of_memfun<__decay_t<_MemPtr>,
2878 typename __inv_unwrap<_Arg>::type, _Args...>
2882 struct __result_of_other_impl
2884 template<
typename _Fn,
typename... _Args>
2885 static __result_of_success<decltype(
2886 std::declval<_Fn>()(std::declval<_Args>()...)
2887 ), __invoke_other> _S_test(
int);
2889 template<
typename...>
2890 static __failure_type _S_test(...);
2893 template<
typename _Functor,
typename... _ArgTypes>
2894 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2895 :
private __result_of_other_impl
2897 using type = decltype(_S_test<_Functor, _ArgTypes...>(0));
2901 template<
typename _Functor,
typename... _ArgTypes>
2902 struct __invoke_result
2903 :
public __result_of_impl<
2904 is_member_object_pointer<
2905 typename remove_reference<_Functor>::type
2907 is_member_function_pointer<
2908 typename remove_reference<_Functor>::type
2910 _Functor, _ArgTypes...
2915 template<
typename _Fn,
typename... _Args>
2916 using __invoke_result_t =
typename __invoke_result<_Fn, _Args...>::type;
2919 template<
typename _Functor,
typename... _ArgTypes>
2920 struct result_of<_Functor(_ArgTypes...)>
2921 :
public __invoke_result<_Functor, _ArgTypes...>
2922 { } _GLIBCXX17_DEPRECATED_SUGGEST(
"std::invoke_result");
2924 #if __cplusplus >= 201402L
2925 #pragma GCC diagnostic push
2926 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2928 template<
size_t _Len,
2929 size_t _Align = __aligned_storage_default_alignment(_Len)>
2932 template <
size_t _Len,
typename... _Types>
2933 using aligned_union_t _GLIBCXX23_DEPRECATED =
typename aligned_union<_Len, _Types...>::type;
2934 #pragma GCC diagnostic pop
2937 template<
typename _Tp>
2941 template<
bool _Cond,
typename _Tp =
void>
2945 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2949 template<
typename... _Tp>
2953 template<
typename _Tp>
2957 template<
typename _Tp>
2961 #ifdef __cpp_lib_void_t // C++ >= 17 || GNU++ >= 11
2963 template<
typename...>
using void_t = void;
2973 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
2974 struct __detected_or
2981 template<
typename _Def,
template<
typename...>
class _Op,
typename... _Args>
2982 requires requires {
typename _Op<_Args...>; }
2983 struct __detected_or<_Def, _Op, _Args...>
2985 using type = _Op<_Args...>;
2990 template<
typename _Default,
typename _AlwaysVoid,
2991 template<
typename...>
class _Op,
typename... _Args>
2994 using type = _Default;
2999 template<
typename _Default,
template<
typename...>
class _Op,
3001 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
3003 using type = _Op<_Args...>;
3007 template<
typename _Default,
template<
typename...>
class _Op,
3009 using __detected_or = __detector<_Default, void, _Op, _Args...>;
3010 #endif // __cpp_concepts
3013 template<
typename _Default,
template<
typename...>
class _Op,
3015 using __detected_or_t
3016 =
typename __detected_or<_Default, _Op, _Args...>::type;
3022 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
3023 template<typename _Tp, typename = __void_t<>> \
3024 struct __has_##_NTYPE \
3027 template<typename _Tp> \
3028 struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
3032 template <
typename _Tp>
3033 struct __is_swappable;
3035 template <
typename _Tp>
3036 struct __is_nothrow_swappable;
3043 template<
typename _Tp>
3044 struct __is_tuple_like
3045 :
public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type
3049 template<
typename _Tp>
3050 _GLIBCXX20_CONSTEXPR
3052 _Require<__not_<__is_tuple_like<_Tp>>,
3053 is_move_constructible<_Tp>,
3054 is_move_assignable<_Tp>>
3056 noexcept(__and_<is_nothrow_move_constructible<_Tp>,
3057 is_nothrow_move_assignable<_Tp>>::value);
3059 template<
typename _Tp,
size_t _Nm>
3060 _GLIBCXX20_CONSTEXPR
3062 __enable_if_t<__is_swappable<_Tp>::value>
3063 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
3064 noexcept(__is_nothrow_swappable<_Tp>::value);
3067 namespace __swappable_details {
3070 struct __do_is_swappable_impl
3072 template<
typename _Tp,
typename
3073 = decltype(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
3080 struct __do_is_nothrow_swappable_impl
3082 template<
typename _Tp>
3083 static __bool_constant<
3084 noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
3093 template<
typename _Tp>
3094 struct __is_swappable_impl
3095 :
public __swappable_details::__do_is_swappable_impl
3097 using type = decltype(__test<_Tp>(0));
3100 template<
typename _Tp>
3101 struct __is_nothrow_swappable_impl
3102 :
public __swappable_details::__do_is_nothrow_swappable_impl
3104 using type = decltype(__test<_Tp>(0));
3107 template<
typename _Tp>
3108 struct __is_swappable
3109 :
public __is_swappable_impl<_Tp>::type
3112 template<
typename _Tp>
3113 struct __is_nothrow_swappable
3114 :
public __is_nothrow_swappable_impl<_Tp>::type
3118 #ifdef __cpp_lib_is_swappable // C++ >= 17 || GNU++ >= 11
3122 template<
typename _Tp>
3124 :
public __is_swappable_impl<_Tp>::type
3126 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3127 "template argument must be a complete class or an unbounded array");
3131 template<
typename _Tp>
3132 struct is_nothrow_swappable
3133 :
public __is_nothrow_swappable_impl<_Tp>::type
3135 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3136 "template argument must be a complete class or an unbounded array");
3139 #if __cplusplus >= 201402L
3141 template<
typename _Tp>
3142 _GLIBCXX17_INLINE constexpr
bool is_swappable_v =
3143 is_swappable<_Tp>::value;
3146 template<
typename _Tp>
3147 _GLIBCXX17_INLINE constexpr
bool is_nothrow_swappable_v =
3148 is_nothrow_swappable<_Tp>::value;
3149 #endif // __cplusplus >= 201402L
3152 namespace __swappable_with_details {
3155 struct __do_is_swappable_with_impl
3157 template<
typename _Tp,
typename _Up,
typename
3158 = decltype(swap(std::declval<_Tp>(), std::declval<_Up>())),
3160 = decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))>
3163 template<
typename,
typename>
3167 struct __do_is_nothrow_swappable_with_impl
3169 template<
typename _Tp,
typename _Up>
3170 static __bool_constant<
3171 noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))
3173 noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()))
3176 template<
typename,
typename>
3182 template<
typename _Tp,
typename _Up>
3183 struct __is_swappable_with_impl
3184 :
public __swappable_with_details::__do_is_swappable_with_impl
3186 using type = decltype(__test<_Tp, _Up>(0));
3190 template<
typename _Tp>
3191 struct __is_swappable_with_impl<_Tp&, _Tp&>
3192 :
public __swappable_details::__do_is_swappable_impl
3194 using type = decltype(__test<_Tp&>(0));
3197 template<
typename _Tp,
typename _Up>
3198 struct __is_nothrow_swappable_with_impl
3199 :
public __swappable_with_details::__do_is_nothrow_swappable_with_impl
3201 using type = decltype(__test<_Tp, _Up>(0));
3205 template<
typename _Tp>
3206 struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
3207 :
public __swappable_details::__do_is_nothrow_swappable_impl
3209 using type = decltype(__test<_Tp&>(0));
3214 template<
typename _Tp,
typename _Up>
3215 struct is_swappable_with
3216 :
public __is_swappable_with_impl<_Tp, _Up>::type
3218 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3219 "first template argument must be a complete class or an unbounded array");
3220 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3221 "second template argument must be a complete class or an unbounded array");
3225 template<
typename _Tp,
typename _Up>
3226 struct is_nothrow_swappable_with
3227 :
public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
3229 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3230 "first template argument must be a complete class or an unbounded array");
3231 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3232 "second template argument must be a complete class or an unbounded array");
3235 #if __cplusplus >= 201402L
3237 template<
typename _Tp,
typename _Up>
3238 _GLIBCXX17_INLINE constexpr
bool is_swappable_with_v =
3239 is_swappable_with<_Tp, _Up>::value;
3242 template<
typename _Tp,
typename _Up>
3243 _GLIBCXX17_INLINE constexpr
bool is_nothrow_swappable_with_v =
3244 is_nothrow_swappable_with<_Tp, _Up>::value;
3245 #endif // __cplusplus >= 201402L
3247 #endif // __cpp_lib_is_swappable
3254 template<
typename _Result,
typename _Ret,
3255 bool = is_void<_Ret>::value,
typename =
void>
3256 struct __is_invocable_impl
3263 template<
typename _Result,
typename _Ret>
3264 struct __is_invocable_impl<_Result, _Ret,
3266 __void_t<typename _Result::type>>
3272 #pragma GCC diagnostic push
3273 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3275 template<
typename _Result,
typename _Ret>
3276 struct __is_invocable_impl<_Result, _Ret,
3278 __void_t<typename _Result::type>>
3282 using _Res_t =
typename _Result::type;
3286 static _Res_t _S_get() noexcept;
3289 template<typename _Tp>
3290 static
void _S_conv(__type_identity_t<_Tp>) noexcept;
3293 template<typename _Tp,
3294 bool _Nothrow = noexcept(_S_conv<_Tp>(_S_get())),
3295 typename = decltype(_S_conv<_Tp>(_S_get())),
3296 #if __has_builtin(__reference_converts_from_temporary)
3297 bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
3299 bool _Dangle =
false
3302 static __bool_constant<_Nothrow && !_Dangle>
3305 template<
typename _Tp,
bool = false>
3311 using type = decltype(_S_test<_Ret, /* Nothrow = */ true>(1));
3314 using __nothrow_conv = decltype(_S_test<_Ret>(1));
3316 #pragma GCC diagnostic pop
3318 template<
typename _Fn,
typename... _ArgTypes>
3319 struct __is_invocable
3320 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3321 : __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
3323 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3327 template<
typename _Fn,
typename _Tp,
typename... _Args>
3328 constexpr
bool __call_is_nt(__invoke_memfun_ref)
3330 using _Up =
typename __inv_unwrap<_Tp>::type;
3331 return noexcept((std::declval<_Up>().*std::declval<_Fn>())(
3332 std::declval<_Args>()...));
3335 template<
typename _Fn,
typename _Tp,
typename... _Args>
3336 constexpr
bool __call_is_nt(__invoke_memfun_deref)
3338 return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())(
3339 std::declval<_Args>()...));
3342 template<
typename _Fn,
typename _Tp>
3343 constexpr
bool __call_is_nt(__invoke_memobj_ref)
3345 using _Up =
typename __inv_unwrap<_Tp>::type;
3346 return noexcept(std::declval<_Up>().*std::declval<_Fn>());
3349 template<
typename _Fn,
typename _Tp>
3350 constexpr
bool __call_is_nt(__invoke_memobj_deref)
3352 return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>());
3355 template<
typename _Fn,
typename... _Args>
3356 constexpr
bool __call_is_nt(__invoke_other)
3358 return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
3361 template<
typename _Result,
typename _Fn,
typename... _Args>
3362 struct __call_is_nothrow
3364 std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
3368 template<
typename _Fn,
typename... _Args>
3369 using __call_is_nothrow_
3370 = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
3373 template<
typename _Fn,
typename... _Args>
3374 struct __is_nothrow_invocable
3375 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3376 : __bool_constant<__is_nothrow_invocable(_Fn, _Args...)>
3378 : __and_<__is_invocable<_Fn, _Args...>,
3379 __call_is_nothrow_<_Fn, _Args...>>::type
3383 #pragma GCC diagnostic push
3384 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3385 struct __nonesuchbase {};
3386 struct __nonesuch :
private __nonesuchbase {
3387 ~__nonesuch() =
delete;
3388 __nonesuch(__nonesuch
const&) =
delete;
3389 void operator=(__nonesuch
const&) =
delete;
3391 #pragma GCC diagnostic pop
3394 #ifdef __cpp_lib_is_invocable // C++ >= 17
3396 template<
typename _Functor,
typename... _ArgTypes>
3397 struct invoke_result
3398 :
public __invoke_result<_Functor, _ArgTypes...>
3400 static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
3401 "_Functor must be a complete class or an unbounded array");
3402 static_assert((std::__is_complete_or_unbounded(
3403 __type_identity<_ArgTypes>{}) && ...),
3404 "each argument type must be a complete class or an unbounded array");
3408 template<
typename _Fn,
typename... _Args>
3409 using invoke_result_t =
typename invoke_result<_Fn, _Args...>::type;
3412 template<
typename _Fn,
typename... _ArgTypes>
3414 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3415 :
public __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
3417 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3420 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3421 "_Fn must be a complete class or an unbounded array");
3422 static_assert((std::__is_complete_or_unbounded(
3423 __type_identity<_ArgTypes>{}) && ...),
3424 "each argument type must be a complete class or an unbounded array");
3428 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3429 struct is_invocable_r
3430 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
3432 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3433 "_Fn must be a complete class or an unbounded array");
3434 static_assert((std::__is_complete_or_unbounded(
3435 __type_identity<_ArgTypes>{}) && ...),
3436 "each argument type must be a complete class or an unbounded array");
3437 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3438 "_Ret must be a complete class or an unbounded array");
3442 template<
typename _Fn,
typename... _ArgTypes>
3443 struct is_nothrow_invocable
3444 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3445 :
public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)>
3447 : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
3448 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3451 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3452 "_Fn must be a complete class or an unbounded array");
3453 static_assert((std::__is_complete_or_unbounded(
3454 __type_identity<_ArgTypes>{}) && ...),
3455 "each argument type must be a complete class or an unbounded array");
3462 template<
typename _Result,
typename _Ret>
3463 using __is_nt_invocable_impl
3464 =
typename __is_invocable_impl<_Result, _Ret>::__nothrow_conv;
3468 template<
typename _Ret,
typename _Fn,
typename... _ArgTypes>
3469 struct is_nothrow_invocable_r
3470 : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
3471 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3473 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3474 "_Fn must be a complete class or an unbounded array");
3475 static_assert((std::__is_complete_or_unbounded(
3476 __type_identity<_ArgTypes>{}) && ...),
3477 "each argument type must be a complete class or an unbounded array");
3478 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3479 "_Ret must be a complete class or an unbounded array");
3481 #endif // __cpp_lib_is_invocable
3483 #if __cpp_lib_type_trait_variable_templates // C++ >= 17
3498 template <
typename _Tp>
3499 inline constexpr
bool is_void_v = is_void<_Tp>::value;
3500 template <
typename _Tp>
3501 inline constexpr
bool is_null_pointer_v = is_null_pointer<_Tp>::value;
3502 template <
typename _Tp>
3503 inline constexpr
bool is_integral_v = is_integral<_Tp>::value;
3504 template <
typename _Tp>
3505 inline constexpr
bool is_floating_point_v = is_floating_point<_Tp>::value;
3507 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
3508 template <
typename _Tp>
3509 inline constexpr
bool is_array_v = __is_array(_Tp);
3511 template <
typename _Tp>
3512 inline constexpr
bool is_array_v =
false;
3513 template <
typename _Tp>
3514 inline constexpr
bool is_array_v<_Tp[]> =
true;
3515 template <
typename _Tp,
size_t _Num>
3516 inline constexpr
bool is_array_v<_Tp[_Num]> =
true;
3519 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
3520 template <
typename _Tp>
3521 inline constexpr
bool is_pointer_v = __is_pointer(_Tp);
3523 template <
typename _Tp>
3524 inline constexpr
bool is_pointer_v =
false;
3525 template <
typename _Tp>
3526 inline constexpr
bool is_pointer_v<_Tp*> =
true;
3527 template <
typename _Tp>
3528 inline constexpr
bool is_pointer_v<_Tp* const> =
true;
3529 template <
typename _Tp>
3530 inline constexpr
bool is_pointer_v<_Tp* volatile> =
true;
3531 template <
typename _Tp>
3532 inline constexpr
bool is_pointer_v<_Tp* const volatile> =
true;
3535 template <
typename _Tp>
3536 inline constexpr
bool is_lvalue_reference_v =
false;
3537 template <
typename _Tp>
3538 inline constexpr
bool is_lvalue_reference_v<_Tp&> =
true;
3539 template <
typename _Tp>
3540 inline constexpr
bool is_rvalue_reference_v =
false;
3541 template <
typename _Tp>
3542 inline constexpr
bool is_rvalue_reference_v<_Tp&&> =
true;
3544 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
3545 template <
typename _Tp>
3546 inline constexpr
bool is_member_object_pointer_v =
3547 __is_member_object_pointer(_Tp);
3549 template <
typename _Tp>
3550 inline constexpr
bool is_member_object_pointer_v =
3551 is_member_object_pointer<_Tp>::value;
3554 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
3555 template <
typename _Tp>
3556 inline constexpr
bool is_member_function_pointer_v =
3557 __is_member_function_pointer(_Tp);
3559 template <
typename _Tp>
3560 inline constexpr
bool is_member_function_pointer_v =
3561 is_member_function_pointer<_Tp>::value;
3564 #if __cpp_impl_reflection >= 202506L // C++ >= 26
3565 template <
typename _Tp>
3566 inline constexpr
bool is_reflection_v =
false;
3568 inline constexpr
bool is_reflection_v<decltype(^^
int)> =
true;
3570 inline constexpr
bool is_reflection_v<
const decltype(^^
int)> =
true;
3572 inline constexpr
bool is_reflection_v<
volatile decltype(^^
int)> =
true;
3574 inline constexpr
bool is_reflection_v<
const volatile decltype(^^
int)> =
true;
3577 template <
typename _Tp>
3578 inline constexpr
bool is_enum_v = __is_enum(_Tp);
3579 template <
typename _Tp>
3580 inline constexpr
bool is_union_v = __is_union(_Tp);
3581 template <
typename _Tp>
3582 inline constexpr
bool is_class_v = __is_class(_Tp);
3585 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
3586 template <
typename _Tp>
3587 inline constexpr
bool is_reference_v = __is_reference(_Tp);
3589 template <
typename _Tp>
3590 inline constexpr
bool is_reference_v =
false;
3591 template <
typename _Tp>
3592 inline constexpr
bool is_reference_v<_Tp&> =
true;
3593 template <
typename _Tp>
3594 inline constexpr
bool is_reference_v<_Tp&&> =
true;
3597 template <
typename _Tp>
3598 inline constexpr
bool is_arithmetic_v = is_arithmetic<_Tp>::value;
3599 template <
typename _Tp>
3600 inline constexpr
bool is_fundamental_v = is_fundamental<_Tp>::value;
3602 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
3603 template <
typename _Tp>
3604 inline constexpr
bool is_object_v = __is_object(_Tp);
3606 template <
typename _Tp>
3607 inline constexpr
bool is_object_v = is_object<_Tp>::value;
3610 template <
typename _Tp>
3611 inline constexpr
bool is_scalar_v = is_scalar<_Tp>::value;
3612 template <
typename _Tp>
3613 inline constexpr
bool is_compound_v = !is_fundamental_v<_Tp>;
3615 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
3616 template <
typename _Tp>
3617 inline constexpr
bool is_member_pointer_v = __is_member_pointer(_Tp);
3619 template <
typename _Tp>
3620 inline constexpr
bool is_member_pointer_v = is_member_pointer<_Tp>::value;
3623 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
3624 template <
typename _Tp>
3625 inline constexpr
bool is_const_v = __is_const(_Tp);
3627 template <
typename _Tp>
3628 inline constexpr
bool is_const_v =
false;
3629 template <
typename _Tp>
3630 inline constexpr
bool is_const_v<const _Tp> =
true;
3633 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
3634 template <
typename _Tp>
3635 inline constexpr
bool is_function_v = __is_function(_Tp);
3637 template <
typename _Tp>
3638 inline constexpr
bool is_function_v = !is_const_v<const _Tp>;
3639 template <
typename _Tp>
3640 inline constexpr
bool is_function_v<_Tp&> =
false;
3641 template <
typename _Tp>
3642 inline constexpr
bool is_function_v<_Tp&&> =
false;
3645 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
3646 template <
typename _Tp>
3647 inline constexpr
bool is_volatile_v = __is_volatile(_Tp);
3649 template <
typename _Tp>
3650 inline constexpr
bool is_volatile_v =
false;
3651 template <
typename _Tp>
3652 inline constexpr
bool is_volatile_v<volatile _Tp> =
true;
3655 template <
typename _Tp>
3656 _GLIBCXX26_DEPRECATED_SUGGEST(
"is_trivially_default_constructible_v && is_trivially_copyable_v")
3657 inline constexpr
bool is_trivial_v = __is_trivial(_Tp);
3658 template <typename _Tp>
3659 inline constexpr
bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
3660 template <typename _Tp>
3661 inline constexpr
bool is_standard_layout_v = __is_standard_layout(_Tp);
3662 template <typename _Tp>
3663 _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout_v && is_trivial_v")
3664 inline constexpr
bool is_pod_v = __is_pod(_Tp);
3665 template <typename _Tp>
3666 _GLIBCXX17_DEPRECATED
3667 inline constexpr
bool is_literal_type_v = __is_literal_type(_Tp);
3668 template <typename _Tp>
3669 inline constexpr
bool is_empty_v = __is_empty(_Tp);
3670 template <typename _Tp>
3671 inline constexpr
bool is_polymorphic_v = __is_polymorphic(_Tp);
3672 template <typename _Tp>
3673 inline constexpr
bool is_abstract_v = __is_abstract(_Tp);
3674 template <typename _Tp>
3675 inline constexpr
bool is_final_v = __is_final(_Tp);
3677 template <typename _Tp>
3678 inline constexpr
bool is_signed_v = is_signed<_Tp>::value;
3679 template <typename _Tp>
3680 inline constexpr
bool is_unsigned_v = is_unsigned<_Tp>::value;
3682 template <typename _Tp, typename... _Args>
3683 inline constexpr
bool is_constructible_v = __is_constructible(_Tp, _Args...);
3684 template <typename _Tp>
3685 inline constexpr
bool is_default_constructible_v = __is_constructible(_Tp);
3686 template <typename _Tp>
3687 inline constexpr
bool is_copy_constructible_v
3688 = __is_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3689 template <typename _Tp>
3690 inline constexpr
bool is_move_constructible_v
3691 = __is_constructible(_Tp, __add_rval_ref_t<_Tp>);
3693 template <typename _Tp, typename _Up>
3694 inline constexpr
bool is_assignable_v = __is_assignable(_Tp, _Up);
3695 template <typename _Tp>
3696 inline constexpr
bool is_copy_assignable_v
3697 = __is_assignable(__add_lval_ref_t<_Tp>, __add_lval_ref_t<const _Tp>);
3698 template <typename _Tp>
3699 inline constexpr
bool is_move_assignable_v
3700 = __is_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3702 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_destructible)
3703 template <
typename _Tp>
3704 inline constexpr
bool is_destructible_v = __is_destructible(_Tp);
3706 template <
typename _Tp>
3707 inline constexpr
bool is_destructible_v = is_destructible<_Tp>::value;
3710 template <
typename _Tp,
typename... _Args>
3711 inline constexpr
bool is_trivially_constructible_v
3712 = __is_trivially_constructible(_Tp, _Args...);
3713 template <
typename _Tp>
3714 inline constexpr
bool is_trivially_default_constructible_v
3715 = __is_trivially_constructible(_Tp);
3716 template <
typename _Tp>
3717 inline constexpr
bool is_trivially_copy_constructible_v
3718 = __is_trivially_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3719 template <
typename _Tp>
3720 inline constexpr
bool is_trivially_move_constructible_v
3721 = __is_trivially_constructible(_Tp, __add_rval_ref_t<_Tp>);
3723 template <
typename _Tp,
typename _Up>
3724 inline constexpr
bool is_trivially_assignable_v
3725 = __is_trivially_assignable(_Tp, _Up);
3726 template <
typename _Tp>
3727 inline constexpr
bool is_trivially_copy_assignable_v
3728 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3729 __add_lval_ref_t<const _Tp>);
3730 template <
typename _Tp>
3731 inline constexpr
bool is_trivially_move_assignable_v
3732 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3733 __add_rval_ref_t<_Tp>);
3735 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_trivially_destructible)
3736 template <
typename _Tp>
3737 inline constexpr
bool is_trivially_destructible_v
3738 = __is_trivially_destructible(_Tp);
3739 #elif __cpp_concepts
3740 template <
typename _Tp>
3741 inline constexpr
bool is_trivially_destructible_v =
false;
3743 template <
typename _Tp>
3744 requires (!is_reference_v<_Tp>) && requires (_Tp& __t) { __t.~_Tp(); }
3745 inline constexpr
bool is_trivially_destructible_v<_Tp>
3746 = __has_trivial_destructor(_Tp);
3747 template <
typename _Tp>
3748 inline constexpr
bool is_trivially_destructible_v<_Tp&> =
true;
3749 template <
typename _Tp>
3750 inline constexpr
bool is_trivially_destructible_v<_Tp&&> =
true;
3751 template <
typename _Tp,
size_t _Nm>
3752 inline constexpr
bool is_trivially_destructible_v<_Tp[_Nm]>
3753 = is_trivially_destructible_v<_Tp>;
3755 template <
typename _Tp>
3756 inline constexpr
bool is_trivially_destructible_v =
3757 is_trivially_destructible<_Tp>::value;
3760 template <
typename _Tp,
typename... _Args>
3761 inline constexpr
bool is_nothrow_constructible_v
3762 = __is_nothrow_constructible(_Tp, _Args...);
3763 template <
typename _Tp>
3764 inline constexpr
bool is_nothrow_default_constructible_v
3765 = __is_nothrow_constructible(_Tp);
3766 template <
typename _Tp>
3767 inline constexpr
bool is_nothrow_copy_constructible_v
3768 = __is_nothrow_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3769 template <
typename _Tp>
3770 inline constexpr
bool is_nothrow_move_constructible_v
3771 = __is_nothrow_constructible(_Tp, __add_rval_ref_t<_Tp>);
3773 template <
typename _Tp,
typename _Up>
3774 inline constexpr
bool is_nothrow_assignable_v
3775 = __is_nothrow_assignable(_Tp, _Up);
3776 template <
typename _Tp>
3777 inline constexpr
bool is_nothrow_copy_assignable_v
3778 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>,
3779 __add_lval_ref_t<const _Tp>);
3780 template <
typename _Tp>
3781 inline constexpr
bool is_nothrow_move_assignable_v
3782 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3784 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_destructible)
3785 template <
typename _Tp>
3786 inline constexpr
bool is_nothrow_destructible_v
3787 = __is_nothrow_destructible(_Tp);
3789 template <
typename _Tp>
3790 inline constexpr
bool is_nothrow_destructible_v =
3791 is_nothrow_destructible<_Tp>::value;
3794 template <
typename _Tp>
3795 inline constexpr
bool has_virtual_destructor_v
3796 = __has_virtual_destructor(_Tp);
3798 template <
typename _Tp>
3799 inline constexpr
size_t alignment_of_v = alignment_of<_Tp>::value;
3801 #if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) \
3802 && (!defined(__clang__) || __clang_major__ >= 20) // PR118559
3803 template <
typename _Tp>
3804 inline constexpr
size_t rank_v = __array_rank(_Tp);
3806 template <
typename _Tp>
3807 inline constexpr
size_t rank_v = 0;
3808 template <
typename _Tp,
size_t _Size>
3809 inline constexpr
size_t rank_v<_Tp[_Size]> = 1 + rank_v<_Tp>;
3810 template <
typename _Tp>
3811 inline constexpr
size_t rank_v<_Tp[]> = 1 + rank_v<_Tp>;
3814 template <
typename _Tp,
unsigned _Idx = 0>
3815 inline constexpr
size_t extent_v = 0;
3816 template <
typename _Tp,
size_t _Size>
3817 inline constexpr
size_t extent_v<_Tp[_Size], 0> = _Size;
3818 template <
typename _Tp,
unsigned _Idx,
size_t _Size>
3819 inline constexpr
size_t extent_v<_Tp[_Size], _Idx> = extent_v<_Tp, _Idx - 1>;
3820 template <
typename _Tp>
3821 inline constexpr
size_t extent_v<_Tp[], 0> = 0;
3822 template <
typename _Tp,
unsigned _Idx>
3823 inline constexpr
size_t extent_v<_Tp[], _Idx> = extent_v<_Tp, _Idx - 1>;
3825 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
3826 template <
typename _Tp,
typename _Up>
3827 inline constexpr
bool is_same_v = __is_same(_Tp, _Up);
3829 template <
typename _Tp,
typename _Up>
3830 inline constexpr
bool is_same_v =
false;
3831 template <
typename _Tp>
3832 inline constexpr
bool is_same_v<_Tp, _Tp> =
true;
3834 template <
typename _Base,
typename _Derived>
3835 inline constexpr
bool is_base_of_v = __is_base_of(_Base, _Derived);
3836 #ifdef __cpp_lib_is_virtual_base_of // C++ >= 26
3837 template <
typename _Base,
typename _Derived>
3838 inline constexpr
bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived);
3840 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
3841 template <
typename _From,
typename _To>
3842 inline constexpr
bool is_convertible_v = __is_convertible(_From, _To);
3844 template <
typename _From,
typename _To>
3845 inline constexpr
bool is_convertible_v = is_convertible<_From, _To>::value;
3847 template<
typename _Fn,
typename... _Args>
3848 inline constexpr
bool is_invocable_v
3849 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3850 = __is_invocable(_Fn, _Args...);
3852 = is_invocable<_Fn, _Args...>::value;
3854 template<
typename _Fn,
typename... _Args>
3855 inline constexpr
bool is_nothrow_invocable_v
3856 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3857 = __is_nothrow_invocable(_Fn, _Args...);
3859 = is_nothrow_invocable<_Fn, _Args...>::value;
3861 template<
typename _Ret,
typename _Fn,
typename... _Args>
3862 inline constexpr
bool is_invocable_r_v
3863 = is_invocable_r<_Ret, _Fn, _Args...>::value;
3864 template<
typename _Ret,
typename _Fn,
typename... _Args>
3865 inline constexpr
bool is_nothrow_invocable_r_v
3866 = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
3868 #endif // __cpp_lib_type_trait_variable_templates
3870 #ifdef __cpp_lib_has_unique_object_representations // C++ >= 17 && HAS_UNIQ_OBJ_REP
3873 template<
typename _Tp>
3874 struct has_unique_object_representations
3875 : bool_constant<__has_unique_object_representations(
3876 remove_cv_t<remove_all_extents_t<_Tp>>
3879 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3880 "template argument must be a complete class or an unbounded array");
3883 # if __cpp_lib_type_trait_variable_templates // C++ >= 17
3885 template<
typename _Tp>
3886 inline constexpr
bool has_unique_object_representations_v
3887 = has_unique_object_representations<_Tp>::value;
3891 #ifdef __cpp_lib_is_aggregate // C++ >= 17 && builtin_is_aggregate
3894 template<
typename _Tp>
3896 : bool_constant<__is_aggregate(remove_cv_t<_Tp>)>
3899 # if __cpp_lib_type_trait_variable_templates // C++ >= 17
3904 template<
typename _Tp>
3905 inline constexpr
bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>);
3909 #if __cpp_impl_reflection >= 202506L \
3910 && _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_is_consteval_only) // C++ >= 26
3913 template<
typename _Tp>
3914 struct is_consteval_only
3915 : bool_constant<__builtin_is_consteval_only(_Tp)>
3922 template<
typename _Tp>
3923 inline constexpr
bool is_consteval_only_v
3924 = __builtin_is_consteval_only(_Tp);
3931 #ifdef __cpp_lib_remove_cvref // C++ >= 20
3932 # if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
3933 template<
typename _Tp>
3935 {
using type = __remove_cvref(_Tp); };
3937 template<
typename _Tp>
3939 {
using type =
typename remove_cv<_Tp>::type; };
3941 template<
typename _Tp>
3942 struct remove_cvref<_Tp&>
3943 {
using type =
typename remove_cv<_Tp>::type; };
3945 template<
typename _Tp>
3946 struct remove_cvref<_Tp&&>
3947 {
using type =
typename remove_cv<_Tp>::type; };
3950 template<
typename _Tp>
3951 using remove_cvref_t =
typename remove_cvref<_Tp>::type;
3953 #endif // __cpp_lib_remove_cvref
3955 #ifdef __cpp_lib_type_identity // C++ >= 20
3960 template<
typename _Tp>
3961 struct type_identity {
using type = _Tp; };
3963 template<
typename _Tp>
3964 using type_identity_t =
typename type_identity<_Tp>::type;
3968 #ifdef __cpp_lib_unwrap_ref // C++ >= 20
3973 template<
typename _Tp>
3974 struct unwrap_reference {
using type = _Tp; };
3976 template<
typename _Tp>
3977 struct unwrap_reference<reference_wrapper<_Tp>> {
using type = _Tp&; };
3979 template<
typename _Tp>
3980 using unwrap_reference_t =
typename unwrap_reference<_Tp>::type;
3987 template<
typename _Tp>
3988 struct unwrap_ref_decay {
using type = unwrap_reference_t<decay_t<_Tp>>; };
3990 template<
typename _Tp>
3991 using unwrap_ref_decay_t =
typename unwrap_ref_decay<_Tp>::type;
3993 #endif // __cpp_lib_unwrap_ref
3995 #ifdef __cpp_lib_bounded_array_traits // C++ >= 20
3999 # if _GLIBCXX_USE_BUILTIN_TRAIT(__is_bounded_array)
4000 template<
typename _Tp>
4001 inline constexpr
bool is_bounded_array_v = __is_bounded_array(_Tp);
4003 template<
typename _Tp>
4004 inline constexpr
bool is_bounded_array_v =
false;
4006 template<
typename _Tp,
size_t _Size>
4007 inline constexpr
bool is_bounded_array_v<_Tp[_Size]> =
true;
4013 # if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unbounded_array)
4014 template<
typename _Tp>
4015 inline constexpr
bool is_unbounded_array_v = __is_unbounded_array(_Tp);
4017 template<
typename _Tp>
4018 inline constexpr
bool is_unbounded_array_v =
false;
4020 template<
typename _Tp>
4021 inline constexpr
bool is_unbounded_array_v<_Tp[]> =
true;
4026 template<
typename _Tp>
4027 struct is_bounded_array
4028 :
public bool_constant<is_bounded_array_v<_Tp>>
4033 template<
typename _Tp>
4034 struct is_unbounded_array
4035 :
public bool_constant<is_unbounded_array_v<_Tp>>
4037 #endif // __cpp_lib_bounded_array_traits
4039 #if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L
4042 template<
typename _Tp,
typename _Up>
4044 : bool_constant<__is_layout_compatible(_Tp, _Up)>
4049 template<
typename _Tp,
typename _Up>
4051 = __is_layout_compatible(_Tp, _Up);
4053 #if __has_builtin(__builtin_is_corresponding_member)
4054 # ifndef __cpp_lib_is_layout_compatible
4055 # error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set"
4059 template<
typename _S1,
typename _S2,
typename _M1,
typename _M2>
4062 {
return __builtin_is_corresponding_member(__m1, __m2); }
4066 #if __has_builtin(__is_pointer_interconvertible_base_of) \
4067 && __cplusplus >= 202002L
4070 template<
typename _Base,
typename _Derived>
4072 : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)>
4077 template<
typename _Base,
typename _Derived>
4079 = __is_pointer_interconvertible_base_of(_Base, _Derived);
4081 #if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
4082 # ifndef __cpp_lib_is_pointer_interconvertible
4083 # error "libstdc++ bug: is_pointer_interconvertible available but FTM is not set"
4089 template<
typename _Tp,
typename _Mem>
4092 {
return __builtin_is_pointer_interconvertible_with_class(__mp); }
4096 #ifdef __cpp_lib_is_scoped_enum // C++ >= 23
4100 # if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
4101 template<
typename _Tp>
4102 struct is_scoped_enum
4103 : bool_constant<__is_scoped_enum(_Tp)>
4106 template<
typename _Tp>
4107 struct is_scoped_enum
4111 template<
typename _Tp>
4112 requires __is_enum(_Tp)
4113 && requires(remove_cv_t<_Tp> __t) { __t = __t; }
4114 struct is_scoped_enum<_Tp>
4115 : bool_constant<!requires(_Tp __t, void(*__f)(int)) { __f(__t); }>
4121 # if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
4122 template<
typename _Tp>
4123 inline constexpr
bool is_scoped_enum_v = __is_scoped_enum(_Tp);
4125 template<
typename _Tp>
4126 inline constexpr
bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
4130 #ifdef __cpp_lib_is_implicit_lifetime // C++ >= 23
4134 template<
typename _Tp>
4135 struct is_implicit_lifetime
4136 : bool_constant<__builtin_is_implicit_lifetime(_Tp)>
4141 template<
typename _Tp>
4142 inline constexpr
bool is_implicit_lifetime_v
4143 = __builtin_is_implicit_lifetime(_Tp);
4146 #ifdef __cpp_lib_reference_from_temporary // C++ >= 23 && ref_{converts,constructs}_from_temp
4151 template<
typename _Tp,
typename _Up>
4152 struct reference_constructs_from_temporary
4153 :
public bool_constant<__reference_constructs_from_temporary(_Tp, _Up)>
4155 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
4156 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
4157 "template argument must be a complete class or an unbounded array");
4164 template<
typename _Tp,
typename _Up>
4165 struct reference_converts_from_temporary
4166 :
public bool_constant<__reference_converts_from_temporary(_Tp, _Up)>
4168 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
4169 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
4170 "template argument must be a complete class or an unbounded array");
4175 template<
typename _Tp,
typename _Up>
4176 inline constexpr
bool reference_constructs_from_temporary_v
4177 = reference_constructs_from_temporary<_Tp, _Up>::value;
4181 template<
typename _Tp,
typename _Up>
4182 inline constexpr
bool reference_converts_from_temporary_v
4183 = reference_converts_from_temporary<_Tp, _Up>::value;
4184 #endif // __cpp_lib_reference_from_temporary
4186 #ifdef __cpp_lib_is_constant_evaluated // C++ >= 20 && HAVE_IS_CONST_EVAL
4189 [[__gnu__::__always_inline__]]
4191 is_constant_evaluated() noexcept
4193 #if __cpp_if_consteval >= 202106L
4194 if consteval {
return true; }
else {
return false; }
4196 return __builtin_is_constant_evaluated();
4201 #if __cplusplus >= 202002L
4203 template<
typename _From,
typename _To>
4204 using __copy_cv =
typename __match_cv_qualifiers<_From, _To>::__type;
4206 template<
typename _Xp,
typename _Yp>
4208 = decltype(
false ?
declval<_Xp(&)()>()() :
declval<_Yp(&)()>()());
4210 template<
typename _Ap,
typename _Bp,
typename =
void>
4211 struct __common_ref_impl
4215 template<
typename _Ap,
typename _Bp>
4216 using __common_ref =
typename __common_ref_impl<_Ap, _Bp>::type;
4219 template<
typename _Xp,
typename _Yp>
4220 using __condres_cvref
4221 = __cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>;
4224 template<
typename _Xp,
typename _Yp>
4225 struct __common_ref_impl<_Xp&, _Yp&, __void_t<__condres_cvref<_Xp, _Yp>>>
4226 : enable_if<is_reference_v<__condres_cvref<_Xp, _Yp>>,
4227 __condres_cvref<_Xp, _Yp>>
4231 template<
typename _Xp,
typename _Yp>
4232 using __common_ref_C = remove_reference_t<__common_ref<_Xp&, _Yp&>>&&;
4235 template<
typename _Xp,
typename _Yp>
4236 struct __common_ref_impl<_Xp&&, _Yp&&,
4237 _Require<is_convertible<_Xp&&, __common_ref_C<_Xp, _Yp>>,
4238 is_convertible<_Yp&&, __common_ref_C<_Xp, _Yp>>>>
4239 {
using type = __common_ref_C<_Xp, _Yp>; };
4242 template<
typename _Xp,
typename _Yp>
4243 using __common_ref_D = __common_ref<const _Xp&, _Yp&>;
4246 template<
typename _Xp,
typename _Yp>
4247 struct __common_ref_impl<_Xp&&, _Yp&,
4248 _Require<is_convertible<_Xp&&, __common_ref_D<_Xp, _Yp>>>>
4249 {
using type = __common_ref_D<_Xp, _Yp>; };
4252 template<
typename _Xp,
typename _Yp>
4253 struct __common_ref_impl<_Xp&, _Yp&&>
4254 : __common_ref_impl<_Yp&&, _Xp&>
4258 template<
typename _Tp,
typename _Up,
4259 template<
typename>
class _TQual,
template<
typename>
class _UQual>
4260 struct basic_common_reference
4264 template<
typename _Tp>
4266 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>; };
4268 template<
typename _Tp>
4270 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&; };
4272 template<
typename _Tp>
4273 struct __xref<_Tp&&>
4274 {
template<
typename _Up>
using __type = __copy_cv<_Tp, _Up>&&; };
4276 template<
typename _Tp1,
typename _Tp2>
4277 using __basic_common_ref
4278 =
typename basic_common_reference<remove_cvref_t<_Tp1>,
4279 remove_cvref_t<_Tp2>,
4280 __xref<_Tp1>::template __type,
4281 __xref<_Tp2>::template __type>::type;
4284 template<
typename... _Tp>
4285 struct common_reference;
4287 template<
typename... _Tp>
4292 struct common_reference<>
4296 template<
typename _Tp0>
4297 struct common_reference<_Tp0>
4298 {
using type = _Tp0; };
4301 template<
typename _Tp1,
typename _Tp2,
int _Bullet = 1>
4302 struct __common_reference_impl
4303 : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1>
4307 template<
typename _Tp1,
typename _Tp2>
4308 struct common_reference<_Tp1, _Tp2>
4309 : __common_reference_impl<_Tp1, _Tp2>
4313 template<
typename _Tp1,
typename _Tp2>
4314 requires is_reference_v<_Tp1> && is_reference_v<_Tp2>
4315 && requires {
typename __common_ref<_Tp1, _Tp2>; }
4316 #if __cpp_lib_common_reference // C++ >= 20
4317 && is_convertible_v<add_pointer_t<_Tp1>,
4318 add_pointer_t<__common_ref<_Tp1, _Tp2>>>
4319 && is_convertible_v<add_pointer_t<_Tp2>,
4320 add_pointer_t<__common_ref<_Tp1, _Tp2>>>
4322 struct __common_reference_impl<_Tp1, _Tp2, 1>
4323 {
using type = __common_ref<_Tp1, _Tp2>; };
4326 template<
typename _Tp1,
typename _Tp2>
4327 requires requires {
typename __basic_common_ref<_Tp1, _Tp2>; }
4328 struct __common_reference_impl<_Tp1, _Tp2, 2>
4329 {
using type = __basic_common_ref<_Tp1, _Tp2>; };
4332 template<
typename _Tp1,
typename _Tp2>
4333 requires requires {
typename __cond_res<_Tp1, _Tp2>; }
4334 struct __common_reference_impl<_Tp1, _Tp2, 3>
4335 {
using type = __cond_res<_Tp1, _Tp2>; };
4338 template<
typename _Tp1,
typename _Tp2>
4339 requires requires {
typename common_type_t<_Tp1, _Tp2>; }
4340 struct __common_reference_impl<_Tp1, _Tp2, 4>
4341 {
using type = common_type_t<_Tp1, _Tp2>; };
4344 template<
typename _Tp1,
typename _Tp2>
4345 struct __common_reference_impl<_Tp1, _Tp2, 5>
4349 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4350 struct common_reference<_Tp1, _Tp2, _Rest...>
4351 : __common_type_fold<common_reference<_Tp1, _Tp2>,
4352 __common_type_pack<_Rest...>>
4356 template<
typename _Tp1,
typename _Tp2,
typename... _Rest>
4357 struct __common_type_fold<common_reference<_Tp1, _Tp2>,
4358 __common_type_pack<_Rest...>,
4360 :
public common_reference<common_reference_t<_Tp1, _Tp2>, _Rest...>
4366 #if __cplusplus >= 201103L
4369 template<
size_t... _Indexes>
struct _Index_tuple { };
4372 template<
size_t _Num>
4373 struct _Build_index_tuple
4375 #if __has_builtin(__make_integer_seq)
4376 template<
typename,
size_t... _Indices>
4377 using _IdxTuple = _Index_tuple<_Indices...>;
4380 using __type = __make_integer_seq<_IdxTuple, size_t, _Num>;
4383 using __type = _Index_tuple<__integer_pack(_Num)...>;
4388 #ifdef __cpp_lib_constant_wrapper // C++ >= 26
4389 template<
typename _Tp>
4390 struct _CwFixedValue
4395 _CwFixedValue(__type __v) noexcept
4401 template<
typename _Tp,
size_t _Extent>
4402 struct _CwFixedValue<_Tp[_Extent]>
4404 using __type = _Tp[_Extent];
4407 _CwFixedValue(_Tp (&__arr)[_Extent]) noexcept
4408 : _CwFixedValue(__arr,
typename _Build_index_tuple<_Extent>::__type())
4411 template<
size_t... _Indices>
4413 _CwFixedValue(_Tp (&__arr)[_Extent], _Index_tuple<_Indices...>) noexcept
4414 : _M_data{__arr[_Indices]...}
4417 _Tp _M_data[_Extent];
4420 template<
typename _Tp,
size_t _Extent>
4421 _CwFixedValue(_Tp (&)[_Extent]) -> _CwFixedValue<_Tp[_Extent]>;
4423 template<_CwFixedValue _Xv,
4424 typename =
typename decltype(_CwFixedValue(_Xv))::__type>
4425 struct constant_wrapper;
4427 template<
typename _Tp>
4428 concept _ConstExprParam = requires
4430 typename constant_wrapper<_Tp::value>;
4435 template<_ConstExprParam _Tp>
4436 friend constexpr
auto
4437 operator+(_Tp) noexcept -> constant_wrapper<(+_Tp::value)>
4440 template<_ConstExprParam _Tp>
4441 friend constexpr
auto
4442 operator-(_Tp) noexcept -> constant_wrapper<(-_Tp::value)>
4445 template<_ConstExprParam _Tp>
4446 friend constexpr
auto
4447 operator~(_Tp) noexcept -> constant_wrapper<(~_Tp::value)>
4450 template<_ConstExprParam _Tp>
4451 friend constexpr
auto
4452 operator!(_Tp) noexcept -> constant_wrapper<(!_Tp::value)>
4455 template<_ConstExprParam _Tp>
4456 friend constexpr
auto
4457 operator&(_Tp) noexcept -> constant_wrapper<(&_Tp::value)>
4460 template<_ConstExprParam _Tp>
4461 friend constexpr
auto
4462 operator*(_Tp) noexcept -> constant_wrapper<(*_Tp::value)>
4465 template<_ConstExprParam _Left, _ConstExprParam _Right>
4466 friend constexpr
auto
4468 -> constant_wrapper<(_Left::value + _Right::value)>
4471 template<_ConstExprParam _Left, _ConstExprParam _Right>
4472 friend constexpr
auto
4474 -> constant_wrapper<(_Left::value - _Right::value)>
4477 template<_ConstExprParam _Left, _ConstExprParam _Right>
4478 friend constexpr
auto
4480 -> constant_wrapper<(_Left::value * _Right::value)>
4483 template<_ConstExprParam _Left, _ConstExprParam _Right>
4484 friend constexpr
auto
4486 -> constant_wrapper<(_Left::value / _Right::value)>
4489 template<_ConstExprParam _Left, _ConstExprParam _Right>
4490 friend constexpr
auto
4492 -> constant_wrapper<(_Left::value % _Right::value)>
4495 template<_ConstExprParam _Left, _ConstExprParam _Right>
4496 friend constexpr
auto
4498 -> constant_wrapper<(_Left::value << _Right::value)>
4501 template<_ConstExprParam _Left, _ConstExprParam _Right>
4502 friend constexpr
auto
4504 -> constant_wrapper<(_Left::value >> _Right::value)>
4507 template<_ConstExprParam _Left, _ConstExprParam _Right>
4508 friend constexpr
auto
4510 -> constant_wrapper<(_Left::value & _Right::value)>
4513 template<_ConstExprParam _Left, _ConstExprParam _Right>
4514 friend constexpr
auto
4516 -> constant_wrapper<(_Left::value | _Right::value)>
4519 template<_ConstExprParam _Left, _ConstExprParam _Right>
4520 friend constexpr
auto
4522 -> constant_wrapper<(_Left::value ^ _Right::value)>
4525 template<_ConstExprParam _Left, _ConstExprParam _Right>
4526 requires (!is_constructible_v<
bool, decltype(_Left::value)>
4527 || !is_constructible_v<
bool, decltype(_Right::value)>)
4528 friend constexpr auto
4529 operator&&(_Left, _Right) noexcept
4530 -> constant_wrapper<(_Left::value && _Right::value)>
4533 template<_ConstExprParam _Left, _ConstExprParam _Right>
4534 requires (!is_constructible_v<
bool, decltype(_Left::value)>
4535 || !is_constructible_v<
bool, decltype(_Right::value)>)
4536 friend constexpr auto
4537 operator||(_Left, _Right) noexcept
4538 -> constant_wrapper<(_Left::value || _Right::value)>
4541 template<_ConstExprParam _Left, _ConstExprParam _Right>
4542 friend constexpr
auto
4543 operator<=>(_Left, _Right) noexcept
4544 -> constant_wrapper<(_Left::value <=> _Right::value)>
4547 template<_ConstExprParam _Left, _ConstExprParam _Right>
4548 friend constexpr
auto
4550 -> constant_wrapper<(_Left::value < _Right::value)>
4553 template<_ConstExprParam _Left, _ConstExprParam _Right>
4554 friend constexpr
auto
4556 -> constant_wrapper<(_Left::value <= _Right::value)>
4559 template<_ConstExprParam _Left, _ConstExprParam _Right>
4560 friend constexpr
auto
4561 operator==(_Left, _Right) noexcept
4562 -> constant_wrapper<(_Left::value == _Right::value)>
4565 template<_ConstExprParam _Left, _ConstExprParam _Right>
4566 friend constexpr
auto
4567 operator!=(_Left, _Right) noexcept
4568 -> constant_wrapper<(_Left::value != _Right::value)>
4571 template<_ConstExprParam _Left, _ConstExprParam _Right>
4572 friend constexpr
auto
4574 -> constant_wrapper<(_Left::value > _Right::value)>
4577 template<_ConstExprParam _Left, _ConstExprParam _Right>
4578 friend constexpr
auto
4580 -> constant_wrapper<(_Left::value >= _Right::value)>
4583 template<_ConstExprParam _Left, _ConstExprParam _Right>
4584 friend constexpr
auto
4585 operator,(_Left, _Right) noexcept =
delete;
4587 template<_ConstExprParam _Left, _ConstExprParam _Right>
4588 friend constexpr
auto
4589 operator->*(_Left, _Right) noexcept
4590 -> constant_wrapper<_Left::value->*(_Right::value)>
4593 template<_ConstExprParam _Tp, _ConstExprParam... _Args>
4595 operator()(
this _Tp, _Args...) noexcept
4597 requires(_Args...) { constant_wrapper<_Tp::value(_Args::value...)>(); }
4598 {
return constant_wrapper<_Tp::value(_Args::value...)>{}; }
4600 template<_ConstExprParam _Tp, _ConstExprParam... _Args>
4602 operator[](
this _Tp, _Args...) noexcept
4603 -> constant_wrapper<(_Tp::value[_Args::value...])>
4606 template<_ConstExprParam _Tp>
4608 operator++(
this _Tp) noexcept
4609 -> constant_wrapper<(++_Tp::value)>
4612 template<_ConstExprParam _Tp>
4614 operator++(
this _Tp,
int) noexcept
4615 -> constant_wrapper<(_Tp::value++)>
4618 template<_ConstExprParam _Tp>
4620 operator--(
this _Tp) noexcept
4621 -> constant_wrapper<(--_Tp::value)>
4624 template<_ConstExprParam _Tp>
4626 operator--(
this _Tp,
int) noexcept
4627 -> constant_wrapper<(_Tp::value--)>
4630 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4632 operator+=(
this _Tp, _Right) noexcept
4633 -> constant_wrapper<(_Tp::value += _Right::value)>
4636 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4638 operator-=(
this _Tp, _Right) noexcept
4639 -> constant_wrapper<(_Tp::value -= _Right::value)>
4642 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4644 operator*=(
this _Tp, _Right) noexcept
4645 -> constant_wrapper<(_Tp::value *= _Right::value)>
4648 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4650 operator/=(
this _Tp, _Right) noexcept
4651 -> constant_wrapper<(_Tp::value /= _Right::value)>
4654 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4656 operator%=(
this _Tp, _Right) noexcept
4657 -> constant_wrapper<(_Tp::value %= _Right::value)>
4660 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4662 operator&=(
this _Tp, _Right) noexcept
4663 -> constant_wrapper<(_Tp::value &= _Right::value)>
4666 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4668 operator|=(
this _Tp, _Right) noexcept
4669 -> constant_wrapper<(_Tp::value |= _Right::value)>
4672 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4674 operator^=(
this _Tp, _Right) noexcept
4675 -> constant_wrapper<(_Tp::value ^= _Right::value)>
4678 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4680 operator<<=(
this _Tp, _Right) noexcept
4681 -> constant_wrapper<(_Tp::value <<= _Right::value)>
4684 template<_ConstExprParam _Tp, _ConstExprParam _Right>
4686 operator>>=(
this _Tp, _Right) noexcept
4687 -> constant_wrapper<(_Tp::value >>= _Right::value)>
4691 template<_CwFixedValue _Xv,
typename>
4692 struct constant_wrapper : _CwOperators
4694 static constexpr
const auto& value = _Xv._M_data;
4695 using type = constant_wrapper;
4696 using value_type =
typename decltype(_Xv)::__type;
4698 template<_ConstExprParam _Right>
4700 operator=(_Right)
const noexcept
4701 -> constant_wrapper<(value = _Right::value)>
4705 operator decltype(value)()
const noexcept
4709 template<_CwFixedValue _Tp>
4710 constexpr
auto cw = constant_wrapper<_Tp>{};
4715 _GLIBCXX_END_NAMESPACE_VERSION
4721 #endif // _GLIBCXX_TYPE_TRAITS