libstdc++: type_traits Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#ifndef _GLIBCXX_TYPE_TRAITS
30#define _GLIBCXX_TYPE_TRAITS 1
31
32#pragma GCC system_header
33
34#if __cplusplus < 201103L
36#else
37
39
40#define __glibcxx_want_bool_constant
41#define __glibcxx_want_bounded_array_traits
42#define __glibcxx_want_has_unique_object_representations
43#define __glibcxx_want_integral_constant_callable
44#define __glibcxx_want_is_aggregate
45#define __glibcxx_want_is_constant_evaluated
46#define __glibcxx_want_is_final
47#define __glibcxx_want_is_invocable
48#define __glibcxx_want_is_layout_compatible
49#define __glibcxx_want_is_nothrow_convertible
50#define __glibcxx_want_is_null_pointer
51#define __glibcxx_want_is_pointer_interconvertible
52#define __glibcxx_want_is_scoped_enum
53#define __glibcxx_want_is_swappable
54#define __glibcxx_want_logical_traits
55#define __glibcxx_want_reference_from_temporary
56#define __glibcxx_want_remove_cvref
57#define __glibcxx_want_result_of_sfinae
58#define __glibcxx_want_transformation_trait_aliases
59#define __glibcxx_want_type_identity
60#define __glibcxx_want_type_trait_variable_templates
61#define __glibcxx_want_unwrap_ref
62#define __glibcxx_want_void_t
64
65extern "C++"
66{
67namespace std _GLIBCXX_VISIBILITY(default)
68{
69_GLIBCXX_BEGIN_NAMESPACE_VERSION
70
71 template<typename _Tp>
72 class reference_wrapper;
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 template<typename _Tp, _Tp __v>
90 {
91 static constexpr _Tp value = __v;
92 using value_type = _Tp;
94 constexpr operator value_type() const noexcept { return value; }
95
96#ifdef __cpp_lib_integral_constant_callable
97 constexpr value_type operator()() const noexcept { return value; }
98#endif
99 };
100
101#if ! __cpp_inline_variables
102 template<typename _Tp, _Tp __v>
104#endif
105
106
107
108 template<bool __v>
110
111
112
114
115
117
118#ifdef __cpp_lib_bool_constant
119
120
121 template<bool __v>
122 using bool_constant = __bool_constant<__v>;
123#endif
124
125
126
127
128
129 template<bool, typename _Tp = void>
131 { };
132
133
134 template<typename _Tp>
136 { using type = _Tp; };
137
138
139 template<bool _Cond, typename _Tp = void>
140 using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
141
142 template<bool>
143 struct __conditional
144 {
145 template<typename _Tp, typename>
146 using type = _Tp;
147 };
148
149 template<>
150 struct __conditional
151 {
152 template<typename, typename _Up>
153 using type = _Up;
154 };
155
156
157 template<bool _Cond, typename _If, typename _Else>
158 using __conditional_t
159 = typename __conditional<_Cond>::template type<_If, _Else>;
160
161
162 template <typename _Type>
163 struct __type_identity
164 { using type = _Type; };
165
166 template<typename _Tp>
167 using __type_identity_t = typename __type_identity<_Tp>::type;
168
169 namespace __detail
170 {
171
172 template<typename _Tp, typename...>
173 using __first_t = _Tp;
174
175
176 template<typename... _Bn>
177 auto __or_fn(int) -> __first_t<false_type,
178 __enable_if_t<!bool(_Bn::value)>...>;
179
180 template<typename... _Bn>
182
183 template<typename... _Bn>
184 auto __and_fn(int) -> __first_t<true_type,
185 __enable_if_t<bool(_Bn::value)>...>;
186
187 template<typename... _Bn>
189 }
190
191
192
193
194 template<typename... _Bn>
195 struct __or_
196 : decltype(__detail::__or_fn<_Bn...>(0))
197 { };
198
199 template<typename... _Bn>
200 struct __and_
201 : decltype(__detail::__and_fn<_Bn...>(0))
202 { };
203
204 template<typename _Pp>
205 struct __not_
206 : __bool_constant<!bool(_Pp::value)>
207 { };
208
209
210#ifdef __cpp_lib_logical_traits
211
212
213 template<typename... _Bn>
214 inline constexpr bool __or_v = __or_<_Bn...>::value;
215 template<typename... _Bn>
216 inline constexpr bool __and_v = __and_<_Bn...>::value;
217
218 namespace __detail
219 {
220 template<typename , typename _B1, typename... _Bn>
221 struct __disjunction_impl
222 { using type = _B1; };
223
224 template<typename _B1, typename _B2, typename... _Bn>
225 struct __disjunction_impl<__enable_if_t<!bool(_B1::value)>, _B1, _B2, _Bn...>
226 { using type = typename __disjunction_impl<void, _B2, _Bn...>::type; };
227
228 template<typename , typename _B1, typename... _Bn>
229 struct __conjunction_impl
230 { using type = _B1; };
231
232 template<typename _B1, typename _B2, typename... _Bn>
233 struct __conjunction_impl<__enable_if_t<bool(_B1::value)>, _B1, _B2, _Bn...>
234 { using type = typename __conjunction_impl<void, _B2, _Bn...>::type; };
235 }
236
237
238 template<typename... _Bn>
239 struct conjunction
240 : __detail::__conjunction_impl<void, _Bn...>::type
241 { };
242
243 template<>
244 struct conjunction<>
246 { };
247
248 template<typename... _Bn>
249 struct disjunction
250 : __detail::__disjunction_impl<void, _Bn...>::type
251 { };
252
253 template<>
254 struct disjunction<>
256 { };
257
258 template<typename _Pp>
259 struct negation
260 : __not_<_Pp>::type
261 { };
262
263
264
265
266 template<typename... _Bn>
267 inline constexpr bool conjunction_v = conjunction<_Bn...>::value;
268
269 template<typename... _Bn>
270 inline constexpr bool disjunction_v = disjunction<_Bn...>::value;
271
272 template<typename _Pp>
273 inline constexpr bool negation_v = negation<_Pp>::value;
274
275
276#endif
277
278
279 template<typename>
280 struct is_reference;
281 template<typename>
282 struct is_function;
283 template<typename>
284 struct is_void;
285 template<typename>
286 struct remove_cv;
287 template<typename>
288 struct is_const;
289
290
291 template<typename>
292 struct __is_array_unknown_bounds;
293
294
295
296
297 template <typename _Tp, size_t = sizeof(_Tp)>
298 constexpr true_type __is_complete_or_unbounded(__type_identity<_Tp>)
299 { return {}; }
300
301 template <typename _TypeIdentity,
302 typename _NestedType = typename _TypeIdentity::type>
303 constexpr typename __or_<
304 is_reference<_NestedType>,
305 is_function<_NestedType>,
306 is_void<_NestedType>,
307 __is_array_unknown_bounds<_NestedType>
308 >::type __is_complete_or_unbounded(_TypeIdentity)
309 { return {}; }
310
311
312 template<typename _Tp>
313 using __remove_cv_t = typename remove_cv<_Tp>::type;
314
315
316
317
318
319 template<typename _Tp>
322
323 template<>
326
327 template<>
328 struct is_void
330
331 template<>
332 struct is_void
334
335 template<>
336 struct is_void
338
339
340 template<typename>
341 struct __is_integral_helper
343
344 template<>
345 struct __is_integral_helper
347
348 template<>
349 struct __is_integral_helper
351
352 template<>
353 struct __is_integral_helper
355
356 template<>
357 struct __is_integral_helper
359
360
361
362
363 template<>
364 struct __is_integral_helper<wchar_t>
366
367#ifdef _GLIBCXX_USE_CHAR8_T
368 template<>
369 struct __is_integral_helper<char8_t>
371#endif
372
373 template<>
374 struct __is_integral_helper<char16_t>
376
377 template<>
378 struct __is_integral_helper<char32_t>
380
381 template<>
382 struct __is_integral_helper
384
385 template<>
386 struct __is_integral_helper
388
389 template<>
390 struct __is_integral_helper
392
393 template<>
394 struct __is_integral_helper
396
397 template<>
398 struct __is_integral_helper
400
401 template<>
402 struct __is_integral_helper
404
405 template<>
406 struct __is_integral_helper
408
409 template<>
410 struct __is_integral_helper
412
413
414
415#if defined(__GLIBCXX_TYPE_INT_N_0)
416 __extension__
417 template<>
418 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
420
421 __extension__
422 template<>
423 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
425#endif
426#if defined(__GLIBCXX_TYPE_INT_N_1)
427 __extension__
428 template<>
429 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
431
432 __extension__
433 template<>
434 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
436#endif
437#if defined(__GLIBCXX_TYPE_INT_N_2)
438 __extension__
439 template<>
440 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
442
443 __extension__
444 template<>
445 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
447#endif
448#if defined(__GLIBCXX_TYPE_INT_N_3)
449 __extension__
450 template<>
451 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
453
454 __extension__
455 template<>
456 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
458#endif
459
460
461
462 template<typename _Tp>
464 : public __is_integral_helper<__remove_cv_t<_Tp>>::type
465 { };
466
467
468 template<typename>
469 struct __is_floating_point_helper
471
472 template<>
473 struct __is_floating_point_helper
475
476 template<>
477 struct __is_floating_point_helper
479
480 template<>
481 struct __is_floating_point_helper
483
484#ifdef __STDCPP_FLOAT16_T__
485 template<>
486 struct __is_floating_point_helper<_Float16>
488#endif
489
490#ifdef __STDCPP_FLOAT32_T__
491 template<>
492 struct __is_floating_point_helper<_Float32>
494#endif
495
496#ifdef __STDCPP_FLOAT64_T__
497 template<>
498 struct __is_floating_point_helper<_Float64>
500#endif
501
502#ifdef __STDCPP_FLOAT128_T__
503 template<>
504 struct __is_floating_point_helper<_Float128>
506#endif
507
508#ifdef __STDCPP_BFLOAT16_T__
509 template<>
510 struct __is_floating_point_helper<__gnu_cxx::__bfloat16_t>
512#endif
513
514#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
515 template<>
516 struct __is_floating_point_helper<__float128>
518#endif
519
520
521
522 template<typename _Tp>
524 : public __is_floating_point_helper<__remove_cv_t<_Tp>>::type
525 { };
526
527
528#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
529 template<typename _Tp>
531 : public __bool_constant<__is_array(_Tp)>
532 { };
533#else
534 template<typename>
537
538 template<typename _Tp, std::size_t _Size>
541
542 template<typename _Tp>
543 struct is_array<_Tp[]>
545#endif
546
547
548#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
549 template<typename _Tp>
550 struct is_pointer
551 : public __bool_constant<__is_pointer(_Tp)>
552 { };
553#else
554 template<typename _Tp>
557
558 template<typename _Tp>
561
562 template<typename _Tp>
563 struct is_pointer<_Tp* const>
565
566 template<typename _Tp>
567 struct is_pointer<_Tp* volatile>
569
570 template<typename _Tp>
571 struct is_pointer<_Tp* const volatile>
573#endif
574
575
576 template<typename>
579
580 template<typename _Tp>
583
584
585 template<typename>
588
589 template<typename _Tp>
592
593
594#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
595 template<typename _Tp>
596 struct is_member_object_pointer
597 : public __bool_constant<__is_member_object_pointer(_Tp)>
598 { };
599#else
600 template<typename>
603
604 template<typename _Tp, typename _Cp>
606 : public __not_<is_function<_Tp>>::type { };
607
608
609 template<typename _Tp>
610 struct is_member_object_pointer
611 : public __is_member_object_pointer_helper<__remove_cv_t<_Tp>>::type
612 { };
613#endif
614
615#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
616
617 template<typename _Tp>
618 struct is_member_function_pointer
619 : public __bool_constant<__is_member_function_pointer(_Tp)>
620 { };
621#else
622 template<typename>
623 struct __is_member_function_pointer_helper
625
626 template<typename _Tp, typename _Cp>
627 struct __is_member_function_pointer_helper<_Tp _Cp::*>
628 : public is_function<_Tp>::type { };
629
630
631 template<typename _Tp>
633 : public __is_member_function_pointer_helper<__remove_cv_t<_Tp>>::type
634 { };
635#endif
636
637
638 template<typename _Tp>
640 : public __bool_constant<__is_enum(_Tp)>
641 { };
642
643
644 template<typename _Tp>
646 : public __bool_constant<__is_union(_Tp)>
647 { };
648
649
650 template<typename _Tp>
652 : public __bool_constant<__is_class(_Tp)>
653 { };
654
655
656#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
657 template<typename _Tp>
659 : public __bool_constant<__is_function(_Tp)>
660 { };
661#else
662 template<typename _Tp>
664 : public __bool_constant<!is_const<const _Tp>::value> { };
665
666 template<typename _Tp>
669
670 template<typename _Tp>
671 struct is_function<_Tp&&>
673#endif
674
675#ifdef __cpp_lib_is_null_pointer
676
677 template<typename _Tp>
678 struct is_null_pointer
680
681 template<>
682 struct is_null_pointer<std::nullptr_t>
684
685 template<>
686 struct is_null_pointer<const std::nullptr_t>
688
689 template<>
690 struct is_null_pointer<volatile std::nullptr_t>
692
693 template<>
694 struct is_null_pointer<const volatile std::nullptr_t>
696
697
698
699 template<typename _Tp>
700 struct __is_nullptr_t
701 : public is_null_pointer<_Tp>
702 { } _GLIBCXX_DEPRECATED_SUGGEST("std::is_null_pointer");
703#endif
704
705
706
707
708#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
709 template<typename _Tp>
710 struct is_reference
711 : public __bool_constant<__is_reference(_Tp)>
712 { };
713#else
714 template<typename _Tp>
717 { };
718
719 template<typename _Tp>
722 { };
723
724 template<typename _Tp>
725 struct is_reference<_Tp&&>
727 { };
728#endif
729
730
731 template<typename _Tp>
733 : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
734 { };
735
736
737 template<typename _Tp>
739 : public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
740 is_null_pointer<_Tp>>::type
741 { };
742
743
744#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
745 template<typename _Tp>
747 : public __bool_constant<__is_object(_Tp)>
748 { };
749#else
750 template<typename _Tp>
752 : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
753 is_void<_Tp>>>::type
754 { };
755#endif
756
757 template<typename>
759
760
761 template<typename _Tp>
763 : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
764 is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
765 { };
766
767
768 template<typename _Tp>
770 : public __bool_constant<!is_fundamental<_Tp>::value> { };
771
772
773#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
774 template<typename _Tp>
776 : public __bool_constant<__is_member_pointer(_Tp)>
777 { };
778#else
779
780 template<typename _Tp>
781 struct __is_member_pointer_helper
783
784 template<typename _Tp, typename _Cp>
785 struct __is_member_pointer_helper<_Tp _Cp::*>
787
788
789 template<typename _Tp>
791 : public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type
792 { };
793#endif
794
795 template<typename, typename>
797
798
799 template<typename _Tp, typename... _Types>
800 using __is_one_of = __or_<is_same<_Tp, _Types>...>;
801
802
803 __extension__
804 template<typename _Tp>
805 using __is_signed_integer = __is_one_of<__remove_cv_t<_Tp>,
806 signed char, signed short, signed int, signed long,
807 signed long long
808#if defined(__GLIBCXX_TYPE_INT_N_0)
809 , signed __GLIBCXX_TYPE_INT_N_0
810#endif
811#if defined(__GLIBCXX_TYPE_INT_N_1)
812 , signed __GLIBCXX_TYPE_INT_N_1
813#endif
814#if defined(__GLIBCXX_TYPE_INT_N_2)
815 , signed __GLIBCXX_TYPE_INT_N_2
816#endif
817#if defined(__GLIBCXX_TYPE_INT_N_3)
818 , signed __GLIBCXX_TYPE_INT_N_3
819#endif
820 >;
821
822
823 __extension__
824 template<typename _Tp>
825 using __is_unsigned_integer = __is_one_of<__remove_cv_t<_Tp>,
826 unsigned char, unsigned short, unsigned int, unsigned long,
827 unsigned long long
828#if defined(__GLIBCXX_TYPE_INT_N_0)
829 , unsigned __GLIBCXX_TYPE_INT_N_0
830#endif
831#if defined(__GLIBCXX_TYPE_INT_N_1)
832 , unsigned __GLIBCXX_TYPE_INT_N_1
833#endif
834#if defined(__GLIBCXX_TYPE_INT_N_2)
835 , unsigned __GLIBCXX_TYPE_INT_N_2
836#endif
837#if defined(__GLIBCXX_TYPE_INT_N_3)
838 , unsigned __GLIBCXX_TYPE_INT_N_3
839#endif
840 >;
841
842
843 template<typename _Tp>
844 using __is_standard_integer
845 = __or_<__is_signed_integer<_Tp>, __is_unsigned_integer<_Tp>>;
846
847
848 template<typename...> using __void_t = void;
849
850
851
852
853
854#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
855 template<typename _Tp>
857 : public __bool_constant<__is_const(_Tp)>
858 { };
859#else
860 template<typename>
863
864 template<typename _Tp>
867#endif
868
869
870#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
871 template<typename _Tp>
872 struct is_volatile
873 : public __bool_constant<__is_volatile(_Tp)>
874 { };
875#else
876 template<typename>
879
880 template<typename _Tp>
883#endif
884
885
886 template<typename _Tp>
888 : public __bool_constant<__is_trivial(_Tp)>
889 {
890 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
891 "template argument must be a complete class or an unbounded array");
892 };
893
894
895 template<typename _Tp>
897 : public __bool_constant<__is_trivially_copyable(_Tp)>
898 {
899 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
900 "template argument must be a complete class or an unbounded array");
901 };
902
903
904 template<typename _Tp>
906 : public __bool_constant<__is_standard_layout(_Tp)>
907 {
908 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
909 "template argument must be a complete class or an unbounded array");
910 };
911
912
913
914
915
916
917 template<typename _Tp>
919 _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout && is_trivial")
921 : public __bool_constant<__is_pod(_Tp)>
922 {
923 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
924 "template argument must be a complete class or an unbounded array");
925 };
926
927
928
929
930
931 template<typename _Tp>
933 _GLIBCXX17_DEPRECATED
935 : public __bool_constant<__is_literal_type(_Tp)>
936 {
937 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
938 "template argument must be a complete class or an unbounded array");
939 };
940
941
942 template<typename _Tp>
944 : public __bool_constant<__is_empty(_Tp)>
945 { };
946
947
948 template<typename _Tp>
950 : public __bool_constant<__is_polymorphic(_Tp)>
951 { };
952
953#ifdef __cpp_lib_is_final
954
955
956 template<typename _Tp>
957 struct is_final
958 : public __bool_constant<__is_final(_Tp)>
959 { };
960#endif
961
962
963 template<typename _Tp>
965 : public __bool_constant<__is_abstract(_Tp)>
966 { };
967
968
969 template<typename _Tp,
971 struct __is_signed_helper
973
974 template<typename _Tp>
975 struct __is_signed_helper<_Tp, true>
976 : public __bool_constant<_Tp(-1) < _Tp(0)>
977 { };
978
979
980
981 template<typename _Tp>
982 struct is_signed
983 : public __is_signed_helper<_Tp>::type
984 { };
985
986
987 template<typename _Tp>
988 struct is_unsigned
989 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
990 { };
991
992
993 template<typename _Tp, typename _Up = _Tp&&>
994 _Up
995 __declval(int);
996
997 template<typename _Tp>
998 _Tp
999 __declval(long);
1000
1001
1002 template<typename _Tp>
1003 auto declval() noexcept -> decltype(__declval<_Tp>(0));
1004
1005 template
1007
1008
1009 template<typename _Tp>
1010 struct __is_array_known_bounds
1012 { };
1013
1014 template<typename _Tp, size_t _Size>
1015 struct __is_array_known_bounds<_Tp[_Size]>
1017 { };
1018
1019 template<typename _Tp>
1020 struct __is_array_unknown_bounds
1022 { };
1023
1024 template<typename _Tp>
1025 struct __is_array_unknown_bounds<_Tp[]>
1027 { };
1028
1029
1030
1031
1032
1033
1034
1035
1036 struct __do_is_destructible_impl
1037 {
1038 template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
1039 static true_type __test(int);
1040
1041 template<typename>
1043 };
1044
1045 template<typename _Tp>
1046 struct __is_destructible_impl
1047 : public __do_is_destructible_impl
1048 {
1049 using type = decltype(__test<_Tp>(0));
1050 };
1051
1052 template<typename _Tp,
1053 bool = __or_<is_void<_Tp>,
1054 __is_array_unknown_bounds<_Tp>,
1055 is_function<_Tp>>::value,
1056 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1057 struct __is_destructible_safe;
1058
1059 template<typename _Tp>
1060 struct __is_destructible_safe<_Tp, false, false>
1061 : public __is_destructible_impl<typename
1062 remove_all_extents<_Tp>::type>::type
1063 { };
1064
1065 template<typename _Tp>
1066 struct __is_destructible_safe<_Tp, true, false>
1068
1069 template<typename _Tp>
1070 struct __is_destructible_safe<_Tp, false, true>
1072
1073
1074
1075 template<typename _Tp>
1077 : public __is_destructible_safe<_Tp>::type
1078 {
1079 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1080 "template argument must be a complete class or an unbounded array");
1081 };
1082
1083
1084
1085
1086
1087
1088
1089 struct __do_is_nt_destructible_impl
1090 {
1091 template<typename _Tp>
1092 static __bool_constant<noexcept(declval<_Tp&>().~_Tp())>
1093 __test(int);
1094
1095 template<typename>
1097 };
1098
1099 template<typename _Tp>
1100 struct __is_nt_destructible_impl
1101 : public __do_is_nt_destructible_impl
1102 {
1103 using type = decltype(__test<_Tp>(0));
1104 };
1105
1106 template<typename _Tp,
1107 bool = __or_<is_void<_Tp>,
1108 __is_array_unknown_bounds<_Tp>,
1109 is_function<_Tp>>::value,
1110 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
1111 struct __is_nt_destructible_safe;
1112
1113 template<typename _Tp>
1114 struct __is_nt_destructible_safe<_Tp, false, false>
1115 : public __is_nt_destructible_impl<typename
1116 remove_all_extents<_Tp>::type>::type
1117 { };
1118
1119 template<typename _Tp>
1120 struct __is_nt_destructible_safe<_Tp, true, false>
1122
1123 template<typename _Tp>
1124 struct __is_nt_destructible_safe<_Tp, false, true>
1126
1127
1128
1129 template<typename _Tp>
1131 : public __is_nt_destructible_safe<_Tp>::type
1132 {
1133 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1134 "template argument must be a complete class or an unbounded array");
1135 };
1136
1137
1138 template<typename _Tp, typename... _Args>
1139 using __is_constructible_impl
1140 = __bool_constant<__is_constructible(_Tp, _Args...)>;
1141
1142
1143
1144 template<typename _Tp, typename... _Args>
1146 : public __is_constructible_impl<_Tp, _Args...>
1147 {
1148 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1149 "template argument must be a complete class or an unbounded array");
1150 };
1151
1152
1153 template<typename _Tp>
1155 : public __is_constructible_impl<_Tp>
1156 {
1157 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1158 "template argument must be a complete class or an unbounded array");
1159 };
1160
1161
1162#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference)
1163 template<typename _Tp>
1164 using __add_lval_ref_t = __add_lvalue_reference(_Tp);
1165#else
1166 template<typename _Tp, typename = void>
1167 struct __add_lvalue_reference_helper
1168 { using type = _Tp; };
1169
1170 template<typename _Tp>
1171 struct __add_lvalue_reference_helper<_Tp, __void_t<_Tp&>>
1172 { using type = _Tp&; };
1173
1174 template<typename _Tp>
1175 using __add_lval_ref_t = typename __add_lvalue_reference_helper<_Tp>::type;
1176#endif
1177
1178
1179
1180 template<typename _Tp>
1182 : public __is_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1183 {
1184 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1185 "template argument must be a complete class or an unbounded array");
1186 };
1187
1188
1189#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_rvalue_reference)
1190 template<typename _Tp>
1191 using __add_rval_ref_t = __add_rvalue_reference(_Tp);
1192#else
1193 template<typename _Tp, typename = void>
1194 struct __add_rvalue_reference_helper
1195 { using type = _Tp; };
1196
1197 template<typename _Tp>
1198 struct __add_rvalue_reference_helper<_Tp, __void_t<_Tp&&>>
1199 { using type = _Tp&&; };
1200
1201 template<typename _Tp>
1202 using __add_rval_ref_t = typename __add_rvalue_reference_helper<_Tp>::type;
1203#endif
1204
1205
1206
1207 template<typename _Tp>
1209 : public __is_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1210 {
1211 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1212 "template argument must be a complete class or an unbounded array");
1213 };
1214
1215
1216 template<typename _Tp, typename... _Args>
1217 using __is_nothrow_constructible_impl
1218 = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;
1219
1220
1221
1222 template<typename _Tp, typename... _Args>
1224 : public __is_nothrow_constructible_impl<_Tp, _Args...>
1225 {
1226 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1227 "template argument must be a complete class or an unbounded array");
1228 };
1229
1230
1231 template<typename _Tp>
1233 : public __is_nothrow_constructible_impl<_Tp>
1234 {
1235 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1236 "template argument must be a complete class or an unbounded array");
1237 };
1238
1239
1240 template<typename _Tp>
1242 : public __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1243 {
1244 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1245 "template argument must be a complete class or an unbounded array");
1246 };
1247
1248
1249 template<typename _Tp>
1251 : public __is_nothrow_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1252 {
1253 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1254 "template argument must be a complete class or an unbounded array");
1255 };
1256
1257
1258 template<typename _Tp, typename _Up>
1259 using __is_assignable_impl = __bool_constant<__is_assignable(_Tp, _Up)>;
1260
1261
1262
1263 template<typename _Tp, typename _Up>
1265 : public __is_assignable_impl<_Tp, _Up>
1266 {
1267 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1268 "template argument must be a complete class or an unbounded array");
1269 };
1270
1271
1272 template<typename _Tp>
1274 : public __is_assignable_impl<__add_lval_ref_t<_Tp>,
1275 __add_lval_ref_t<const _Tp>>
1276 {
1277 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1278 "template argument must be a complete class or an unbounded array");
1279 };
1280
1281
1282 template<typename _Tp>
1284 : public __is_assignable_impl<__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>>
1285 {
1286 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1287 "template argument must be a complete class or an unbounded array");
1288 };
1289
1290
1291 template<typename _Tp, typename _Up>
1292 using __is_nothrow_assignable_impl
1293 = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>;
1294
1295
1296
1297 template<typename _Tp, typename _Up>
1299 : public __is_nothrow_assignable_impl<_Tp, _Up>
1300 {
1301 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1302 "template argument must be a complete class or an unbounded array");
1303 };
1304
1305
1306 template<typename _Tp>
1308 : public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1309 __add_lval_ref_t<const _Tp>>
1310 {
1311 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1312 "template argument must be a complete class or an unbounded array");
1313 };
1314
1315
1316 template<typename _Tp>
1318 : public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>,
1319 __add_rval_ref_t<_Tp>>
1320 {
1321 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1322 "template argument must be a complete class or an unbounded array");
1323 };
1324
1325
1326 template<typename _Tp, typename... _Args>
1327 using __is_trivially_constructible_impl
1328 = __bool_constant<__is_trivially_constructible(_Tp, _Args...)>;
1329
1330
1331
1332 template<typename _Tp, typename... _Args>
1334 : public __is_trivially_constructible_impl<_Tp, _Args...>
1335 {
1336 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1337 "template argument must be a complete class or an unbounded array");
1338 };
1339
1340
1341 template<typename _Tp>
1343 : public __is_trivially_constructible_impl<_Tp>
1344 {
1345 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1346 "template argument must be a complete class or an unbounded array");
1347 };
1348
1349#if __cpp_variable_templates && __cpp_concepts
1350 template<typename _Tp>
1351 constexpr bool __is_implicitly_default_constructible_v
1352 = requires (void(&__f)(_Tp)) { __f({}); };
1353
1354 template<typename _Tp>
1355 struct __is_implicitly_default_constructible
1356 : __bool_constant<__is_implicitly_default_constructible_v<_Tp>>
1357 { };
1358#else
1359 struct __do_is_implicitly_default_constructible_impl
1360 {
1361 template <typename _Tp>
1362 static void __helper(const _Tp&);
1363
1364 template <typename _Tp>
1365 static true_type __test(const _Tp&,
1366 decltype(__helper<const _Tp&>({}))* = 0);
1367
1369 };
1370
1371 template<typename _Tp>
1372 struct __is_implicitly_default_constructible_impl
1373 : public __do_is_implicitly_default_constructible_impl
1374 {
1375 using type = decltype(__test(declval<_Tp>()));
1376 };
1377
1378 template<typename _Tp>
1379 struct __is_implicitly_default_constructible_safe
1380 : public __is_implicitly_default_constructible_impl<_Tp>::type
1381 { };
1382
1383 template <typename _Tp>
1384 struct __is_implicitly_default_constructible
1385 : public __and_<__is_constructible_impl<_Tp>,
1386 __is_implicitly_default_constructible_safe<_Tp>>::type
1387 { };
1388#endif
1389
1390
1391 template<typename _Tp>
1393 : public __is_trivially_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>
1394 {
1395 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1396 "template argument must be a complete class or an unbounded array");
1397 };
1398
1399
1400 template<typename _Tp>
1402 : public __is_trivially_constructible_impl<_Tp, __add_rval_ref_t<_Tp>>
1403 {
1404 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1405 "template argument must be a complete class or an unbounded array");
1406 };
1407
1408
1409 template<typename _Tp, typename _Up>
1410 using __is_trivially_assignable_impl
1411 = __bool_constant<__is_trivially_assignable(_Tp, _Up)>;
1412
1413
1414
1415 template<typename _Tp, typename _Up>
1417 : public __is_trivially_assignable_impl<_Tp, _Up>
1418 {
1419 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1420 "template argument must be a complete class or an unbounded array");
1421 };
1422
1423
1424 template<typename _Tp>
1426 : public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1427 __add_lval_ref_t<const _Tp>>
1428 {
1429 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1430 "template argument must be a complete class or an unbounded array");
1431 };
1432
1433
1434 template<typename _Tp>
1436 : public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>,
1437 __add_rval_ref_t<_Tp>>
1438 {
1439 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1440 "template argument must be a complete class or an unbounded array");
1441 };
1442
1443
1444 template<typename _Tp>
1446 : public __and_<__is_destructible_safe<_Tp>,
1447 __bool_constant<__has_trivial_destructor(_Tp)>>::type
1448 {
1449 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1450 "template argument must be a complete class or an unbounded array");
1451 };
1452
1453
1454
1455 template<typename _Tp>
1457 : public __bool_constant<__has_virtual_destructor(_Tp)>
1458 {
1459 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1460 "template argument must be a complete class or an unbounded array");
1461 };
1462
1463
1464
1465
1466
1467 template<typename _Tp>
1470 {
1471 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
1472 "template argument must be a complete class or an unbounded array");
1473 };
1474
1475
1476#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank)
1477 template<typename _Tp>
1480#else
1481 template<typename>
1484
1485 template<typename _Tp, std::size_t _Size>
1486 struct rank<_Tp[_Size]>
1487 : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1488
1489 template<typename _Tp>
1490 struct rank<_Tp[]>
1491 : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1492#endif
1493
1494
1495 template<typename, unsigned _Uint = 0>
1498
1499 template<typename _Tp, size_t _Size>
1500 struct extent<_Tp[_Size], 0>
1502
1503 template<typename _Tp, unsigned _Uint, size_t _Size>
1504 struct extent<_Tp[_Size], _Uint>
1505 : public extent<_Tp, _Uint - 1>::type { };
1506
1507 template<typename _Tp>
1508 struct extent<_Tp[], 0>
1509 : public integral_constant<size_t, 0> { };
1510
1511 template<typename _Tp, unsigned _Uint>
1512 struct extent<_Tp[], _Uint>
1513 : public extent<_Tp, _Uint - 1>::type { };
1514
1515
1516
1517
1518
1519#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
1520 template<typename _Tp, typename _Up>
1521 struct is_same
1522 : public __bool_constant<__is_same(_Tp, _Up)>
1523 { };
1524#else
1525 template<typename _Tp, typename _Up>
1528 { };
1529
1530 template<typename _Tp>
1531 struct is_same<_Tp, _Tp>
1533 { };
1534#endif
1535
1536
1537 template<typename _Base, typename _Derived>
1539 : public __bool_constant<__is_base_of(_Base, _Derived)>
1540 { };
1541
1542#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
1543 template<typename _From, typename _To>
1545 : public __bool_constant<__is_convertible(_From, _To)>
1546 { };
1547#else
1548 template<typename _From, typename _To,
1549 bool = __or_<is_void<_From>, is_function<_To>,
1550 is_array<_To>>::value>
1551 struct __is_convertible_helper
1552 {
1553 using type = typename is_void<_To>::type;
1554 };
1555
1556#pragma GCC diagnostic push
1557#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1558 template<typename _From, typename _To>
1559 class __is_convertible_helper<_From, _To, false>
1560 {
1561 template<typename _To1>
1562 static void __test_aux(_To1) noexcept;
1563
1564 template<typename _From1, typename _To1,
1565 typename = decltype(__test_aux<_To1>(std::declval<_From1>()))>
1567 __test(int);
1568
1569 template<typename, typename>
1571 __test(...);
1572
1573 public:
1574 using type = decltype(__test<_From, _To>(0));
1575 };
1576#pragma GCC diagnostic pop
1577
1578
1579 template<typename _From, typename _To>
1581 : public __is_convertible_helper<_From, _To>::type
1582 { };
1583#endif
1584
1585
1586 template<typename _ToElementType, typename _FromElementType>
1588 = is_convertible<_FromElementType(*)[], _ToElementType(*)[]>;
1589
1590#ifdef __cpp_lib_is_nothrow_convertible
1591
1592#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible)
1593
1594 template<typename _From, typename _To>
1595 inline constexpr bool is_nothrow_convertible_v
1596 = __is_nothrow_convertible(_From, _To);
1597
1598
1599 template<typename _From, typename _To>
1600 struct is_nothrow_convertible
1601 : public bool_constant<is_nothrow_convertible_v<_From, _To>>
1602 { };
1603#else
1604 template<typename _From, typename _To,
1605 bool = __or_<is_void<_From>, is_function<_To>,
1606 is_array<_To>>::value>
1607 struct __is_nt_convertible_helper
1608 : is_void<_To>
1609 { };
1610
1611#pragma GCC diagnostic push
1612#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
1613 template<typename _From, typename _To>
1614 class __is_nt_convertible_helper<_From, _To, false>
1615 {
1616 template<typename _To1>
1617 static void __test_aux(_To1) noexcept;
1618
1619 template<typename _From1, typename _To1>
1620 static
1621 __bool_constant<noexcept(__test_aux<_To1>(std::declval<_From1>()))>
1622 __test(int);
1623
1624 template<typename, typename>
1626 __test(...);
1627
1628 public:
1629 using type = decltype(__test<_From, _To>(0));
1630 };
1631#pragma GCC diagnostic pop
1632
1633
1634 template<typename _From, typename _To>
1635 struct is_nothrow_convertible
1636 : public __is_nt_convertible_helper<_From, _To>::type
1637 { };
1638
1639
1640 template<typename _From, typename _To>
1641 inline constexpr bool is_nothrow_convertible_v
1642 = is_nothrow_convertible<_From, _To>::value;
1643#endif
1644#endif
1645
1646#pragma GCC diagnostic push
1647#pragma GCC diagnostic ignored "-Wc++14-extensions"
1648 template<typename _Tp, typename... _Args>
1649 struct __is_nothrow_new_constructible_impl
1650 : __bool_constant<
1651 noexcept(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))
1652 >
1653 { };
1654
1655 template<typename _Tp, typename... _Args>
1656 _GLIBCXX17_INLINE constexpr bool __is_nothrow_new_constructible
1657 = __and_<is_constructible<_Tp, _Args...>,
1658 __is_nothrow_new_constructible_impl<_Tp, _Args...>>::value;
1659#pragma GCC diagnostic pop
1660
1661
1662
1663
1664 template<typename _Tp>
1666 { using type = _Tp; };
1667
1668 template<typename _Tp>
1670 { using type = _Tp; };
1671
1672
1673 template<typename _Tp>
1675 { using type = _Tp; };
1676
1677 template<typename _Tp>
1679 { using type = _Tp; };
1680
1681
1682#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv)
1683 template<typename _Tp>
1684 struct remove_cv
1685 { using type = __remove_cv(_Tp); };
1686#else
1687 template<typename _Tp>
1689 { using type = _Tp; };
1690
1691 template<typename _Tp>
1693 { using type = _Tp; };
1694
1695 template<typename _Tp>
1696 struct remove_cv<volatile _Tp>
1697 { using type = _Tp; };
1698
1699 template<typename _Tp>
1700 struct remove_cv<const volatile _Tp>
1701 { using type = _Tp; };
1702#endif
1703
1704
1705 template<typename _Tp>
1707 { using type = _Tp const; };
1708
1709
1710 template<typename _Tp>
1712 { using type = _Tp volatile; };
1713
1714
1715 template<typename _Tp>
1717 { using type = _Tp const volatile; };
1718
1719#ifdef __cpp_lib_transformation_trait_aliases
1720
1721 template<typename _Tp>
1722 using remove_const_t = typename remove_const<_Tp>::type;
1723
1724
1725 template<typename _Tp>
1726 using remove_volatile_t = typename remove_volatile<_Tp>::type;
1727
1728
1729 template<typename _Tp>
1730 using remove_cv_t = typename remove_cv<_Tp>::type;
1731
1732
1733 template<typename _Tp>
1734 using add_const_t = typename add_const<_Tp>::type;
1735
1736
1737 template<typename _Tp>
1738 using add_volatile_t = typename add_volatile<_Tp>::type;
1739
1740
1741 template<typename _Tp>
1742 using add_cv_t = typename add_cv<_Tp>::type;
1743#endif
1744
1745
1746
1747
1748#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference)
1749 template<typename _Tp>
1751 { using type = __remove_reference(_Tp); };
1752#else
1753 template<typename _Tp>
1755 { using type = _Tp; };
1756
1757 template<typename _Tp>
1759 { using type = _Tp; };
1760
1761 template<typename _Tp>
1762 struct remove_reference<_Tp&&>
1763 { using type = _Tp; };
1764#endif
1765
1766
1767 template<typename _Tp>
1769 { using type = __add_lval_ref_t<_Tp>; };
1770
1771
1772 template<typename _Tp>
1774 { using type = __add_rval_ref_t<_Tp>; };
1775
1776#if __cplusplus > 201103L
1777
1778 template<typename _Tp>
1780
1781
1782 template<typename _Tp>
1784
1785
1786 template<typename _Tp>
1788#endif
1789
1790
1791
1792
1793
1794
1795 template<typename _Unqualified, bool _IsConst, bool _IsVol>
1796 struct __cv_selector;
1797
1798 template<typename _Unqualified>
1799 struct __cv_selector<_Unqualified, false, false>
1800 { using __type = _Unqualified; };
1801
1802 template<typename _Unqualified>
1803 struct __cv_selector<_Unqualified, false, true>
1804 { using __type = volatile _Unqualified; };
1805
1806 template<typename _Unqualified>
1807 struct __cv_selector<_Unqualified, true, false>
1808 { using __type = const _Unqualified; };
1809
1810 template<typename _Unqualified>
1811 struct __cv_selector<_Unqualified, true, true>
1812 { using __type = const volatile _Unqualified; };
1813
1814 template<typename _Qualified, typename _Unqualified,
1815 bool _IsConst = is_const<_Qualified>::value,
1816 bool _IsVol = is_volatile<_Qualified>::value>
1817 class __match_cv_qualifiers
1818 {
1819 using __match = __cv_selector<_Unqualified, _IsConst, _IsVol>;
1820
1821 public:
1822 using __type = typename __match::__type;
1823 };
1824
1825
1826 template<typename _Tp>
1827 struct __make_unsigned
1828 { using __type = _Tp; };
1829
1830 template<>
1831 struct __make_unsigned
1832 { using __type = unsigned char; };
1833
1834 template<>
1835 struct __make_unsigned
1836 { using __type = unsigned char; };
1837
1838 template<>
1839 struct __make_unsigned
1840 { using __type = unsigned short; };
1841
1842 template<>
1843 struct __make_unsigned
1844 { using __type = unsigned int; };
1845
1846 template<>
1847 struct __make_unsigned
1848 { using __type = unsigned long; };
1849
1850 template<>
1851 struct __make_unsigned
1852 { using __type = unsigned long long; };
1853
1854#if defined(__GLIBCXX_TYPE_INT_N_0)
1855 __extension__
1856 template<>
1857 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1858 { using __type = unsigned __GLIBCXX_TYPE_INT_N_0; };
1859#endif
1860#if defined(__GLIBCXX_TYPE_INT_N_1)
1861 __extension__
1862 template<>
1863 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
1864 { using __type = unsigned __GLIBCXX_TYPE_INT_N_1; };
1865#endif
1866#if defined(__GLIBCXX_TYPE_INT_N_2)
1867 __extension__
1868 template<>
1869 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
1870 { using __type = unsigned __GLIBCXX_TYPE_INT_N_2; };
1871#endif
1872#if defined(__GLIBCXX_TYPE_INT_N_3)
1873 __extension__
1874 template<>
1875 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
1876 { using __type = unsigned __GLIBCXX_TYPE_INT_N_3; };
1877#endif
1878
1879
1880 template<typename _Tp,
1881 bool _IsInt = is_integral<_Tp>::value,
1882 bool _IsEnum = __is_enum(_Tp)>
1883 class __make_unsigned_selector;
1884
1885 template<typename _Tp>
1886 class __make_unsigned_selector<_Tp, true, false>
1887 {
1888 using __unsigned_type
1889 = typename __make_unsigned<__remove_cv_t<_Tp>>::__type;
1890
1891 public:
1892 using __type
1893 = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1894 };
1895
1896 class __make_unsigned_selector_base
1897 {
1898 protected:
1899 template<typename...> struct _List { };
1900
1901 template<typename _Tp, typename... _Up>
1902 struct _List<_Tp, _Up...> : _List<_Up...>
1903 { static constexpr size_t __size = sizeof(_Tp); };
1904
1905 template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
1906 struct __select;
1907
1908 template<size_t _Sz, typename _Uint, typename... _UInts>
1909 struct __select<_Sz, _List<_Uint, _UInts...>, true>
1910 { using __type = _Uint; };
1911
1912 template<size_t _Sz, typename _Uint, typename... _UInts>
1913 struct __select<_Sz, _List<_Uint, _UInts...>, false>
1914 : __select<_Sz, _List<_UInts...>>
1915 { };
1916 };
1917
1918
1919 template<typename _Tp>
1920 class __make_unsigned_selector<_Tp, false, true>
1921 : __make_unsigned_selector_base
1922 {
1923
1924 using _UInts = _List<unsigned char, unsigned short, unsigned int,
1925 unsigned long, unsigned long long>;
1926
1927 using __unsigned_type = typename __select<sizeof(_Tp), _UInts>::__type;
1928
1929 public:
1930 using __type
1931 = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type;
1932 };
1933
1934
1935
1936
1937
1938 template<>
1939 struct __make_unsigned<wchar_t>
1940 {
1941 using __type
1942 = typename __make_unsigned_selector<wchar_t, false, true>::__type;
1943 };
1944
1945#ifdef _GLIBCXX_USE_CHAR8_T
1946 template<>
1947 struct __make_unsigned<char8_t>
1948 {
1949 using __type
1950 = typename __make_unsigned_selector<char8_t, false, true>::__type;
1951 };
1952#endif
1953
1954 template<>
1955 struct __make_unsigned<char16_t>
1956 {
1957 using __type
1958 = typename __make_unsigned_selector<char16_t, false, true>::__type;
1959 };
1960
1961 template<>
1962 struct __make_unsigned<char32_t>
1963 {
1964 using __type
1965 = typename __make_unsigned_selector<char32_t, false, true>::__type;
1966 };
1967
1968
1969
1970
1971
1972
1973 template<typename _Tp>
1975 { using type = typename __make_unsigned_selector<_Tp>::__type; };
1976
1977
1981 template<> struct make_unsigned;
1982
1983
1984
1985
1986 template<typename _Tp>
1987 struct __make_signed
1988 { using __type = _Tp; };
1989
1990 template<>
1991 struct __make_signed
1992 { using __type = signed char; };
1993
1994 template<>
1995 struct __make_signed
1996 { using __type = signed char; };
1997
1998 template<>
1999 struct __make_signed
2000 { using __type = signed short; };
2001
2002 template<>
2003 struct __make_signed
2004 { using __type = signed int; };
2005
2006 template<>
2007 struct __make_signed
2008 { using __type = signed long; };
2009
2010 template<>
2011 struct __make_signed
2012 { using __type = signed long long; };
2013
2014#if defined(__GLIBCXX_TYPE_INT_N_0)
2015 __extension__
2016 template<>
2017 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
2018 { using __type = __GLIBCXX_TYPE_INT_N_0; };
2019#endif
2020#if defined(__GLIBCXX_TYPE_INT_N_1)
2021 __extension__
2022 template<>
2023 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
2024 { using __type = __GLIBCXX_TYPE_INT_N_1; };
2025#endif
2026#if defined(__GLIBCXX_TYPE_INT_N_2)
2027 __extension__
2028 template<>
2029 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
2030 { using __type = __GLIBCXX_TYPE_INT_N_2; };
2031#endif
2032#if defined(__GLIBCXX_TYPE_INT_N_3)
2033 __extension__
2034 template<>
2035 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
2036 { using __type = __GLIBCXX_TYPE_INT_N_3; };
2037#endif
2038
2039
2040 template<typename _Tp,
2041 bool _IsInt = is_integral<_Tp>::value,
2042 bool _IsEnum = __is_enum(_Tp)>
2043 class __make_signed_selector;
2044
2045 template<typename _Tp>
2046 class __make_signed_selector<_Tp, true, false>
2047 {
2048 using __signed_type
2049 = typename __make_signed<__remove_cv_t<_Tp>>::__type;
2050
2051 public:
2052 using __type
2053 = typename __match_cv_qualifiers<_Tp, __signed_type>::__type;
2054 };
2055
2056
2057 template<typename _Tp>
2058 class __make_signed_selector<_Tp, false, true>
2059 {
2060 using __unsigned_type = typename __make_unsigned_selector<_Tp>::__type;
2061
2062 public:
2063 using __type = typename __make_signed_selector<__unsigned_type>::__type;
2064 };
2065
2066
2067
2068
2069
2070 template<>
2071 struct __make_signed<wchar_t>
2072 {
2073 using __type
2074 = typename __make_signed_selector<wchar_t, false, true>::__type;
2075 };
2076
2077#if defined(_GLIBCXX_USE_CHAR8_T)
2078 template<>
2079 struct __make_signed<char8_t>
2080 {
2081 using __type
2082 = typename __make_signed_selector<char8_t, false, true>::__type;
2083 };
2084#endif
2085
2086 template<>
2087 struct __make_signed<char16_t>
2088 {
2089 using __type
2090 = typename __make_signed_selector<char16_t, false, true>::__type;
2091 };
2092
2093 template<>
2094 struct __make_signed<char32_t>
2095 {
2096 using __type
2097 = typename __make_signed_selector<char32_t, false, true>::__type;
2098 };
2099
2100
2101
2102
2103
2104
2105 template<typename _Tp>
2107 { using type = typename __make_signed_selector<_Tp>::__type; };
2108
2109
2111 template<> struct make_signed;
2112 template<> struct make_signed;
2113 template<> struct make_signed;
2114
2115#if __cplusplus > 201103L
2116
2117 template<typename _Tp>
2119
2120
2121 template<typename _Tp>
2123#endif
2124
2125
2126
2127
2128#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_extent)
2129 template<typename _Tp>
2131 { using type = __remove_extent(_Tp); };
2132#else
2133 template<typename _Tp>
2135 { using type = _Tp; };
2136
2137 template<typename _Tp, std::size_t _Size>
2139 { using type = _Tp; };
2140
2141 template<typename _Tp>
2142 struct remove_extent<_Tp[]>
2143 { using type = _Tp; };
2144#endif
2145
2146
2147#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
2148 template<typename _Tp>
2149 struct remove_all_extents
2150 { using type = __remove_all_extents(_Tp); };
2151#else
2152 template<typename _Tp>
2154 { using type = _Tp; };
2155
2156 template<typename _Tp, std::size_t _Size>
2158 { using type = typename remove_all_extents<_Tp>::type; };
2159
2160 template<typename _Tp>
2161 struct remove_all_extents<_Tp[]>
2162 { using type = typename remove_all_extents<_Tp>::type; };
2163#endif
2164
2165#if __cplusplus > 201103L
2166
2167 template<typename _Tp>
2169
2170
2171 template<typename _Tp>
2173#endif
2174
2175
2176
2177
2178#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_pointer)
2179 template<typename _Tp>
2180 struct remove_pointer
2181 { using type = __remove_pointer(_Tp); };
2182#else
2183 template<typename _Tp, typename>
2185 { using type = _Tp; };
2186
2187 template<typename _Tp, typename _Up>
2189 { using type = _Up; };
2190
2191 template<typename _Tp>
2192 struct remove_pointer
2193 : public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>>
2194 { };
2195#endif
2196
2197
2198#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer)
2199 template<typename _Tp>
2200 struct add_pointer
2201 { using type = __add_pointer(_Tp); };
2202#else
2203 template<typename _Tp, typename = void>
2205 { using type = _Tp; };
2206
2207 template<typename _Tp>
2209 { using type = _Tp*; };
2210
2211 template<typename _Tp>
2212 struct add_pointer
2213 : public __add_pointer_helper<_Tp>
2214 { };
2215
2216 template<typename _Tp>
2217 struct add_pointer<_Tp&>
2218 { using type = _Tp*; };
2219
2220 template<typename _Tp>
2221 struct add_pointer<_Tp&&>
2222 { using type = _Tp*; };
2223#endif
2224
2225#if __cplusplus > 201103L
2226
2227 template<typename _Tp>
2229
2230
2231 template<typename _Tp>
2233#endif
2234
2235 template<std::size_t _Len>
2236 struct __aligned_storage_msa
2237 {
2238 union __type
2239 {
2240 unsigned char __data[_Len];
2241 struct __attribute__((__aligned__)) { } __align;
2242 };
2243 };
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258 template<std::size_t _Len, std::size_t _Align =
2259 __alignof__(typename __aligned_storage_msa<_Len>::__type)>
2261 _GLIBCXX23_DEPRECATED
2263 {
2264 union type
2265 {
2266 unsigned char __data[_Len];
2267 struct __attribute__((__aligned__((_Align)))) { } __align;
2268 };
2269 };
2270
2271 template <typename... _Types>
2272 struct __strictest_alignment
2273 {
2274 static const size_t _S_alignment = 0;
2275 static const size_t _S_size = 0;
2276 };
2277
2278 template <typename _Tp, typename... _Types>
2279 struct __strictest_alignment<_Tp, _Types...>
2280 {
2281 static const size_t _S_alignment =
2282 alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
2283 ? alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
2284 static const size_t _S_size =
2285 sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
2286 ? sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
2287 };
2288
2289#pragma GCC diagnostic push
2290#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304 template <size_t _Len, typename... _Types>
2306 _GLIBCXX23_DEPRECATED
2308 {
2309 private:
2310 static_assert(sizeof...(_Types) != 0, "At least one type is required");
2311
2312 using __strictest = __strictest_alignment<_Types...>;
2313 static const size_t _S_len = _Len > __strictest::_S_size
2314 ? _Len : __strictest::_S_size;
2315 public:
2316
2317 static const size_t alignment_value = __strictest::_S_alignment;
2318
2320 };
2321
2322 template <size_t _Len, typename... _Types>
2323 const size_t aligned_union<_Len, _Types...>::alignment_value;
2324#pragma GCC diagnostic pop
2325
2326
2327
2328#if _GLIBCXX_USE_BUILTIN_TRAIT(__decay)
2329 template<typename _Tp>
2331 { using type = __decay(_Tp); };
2332#else
2333
2334
2335 template<typename _Up>
2336 struct __decay_selector
2337 : __conditional_t<is_const<const _Up>::value,
2338 remove_cv<_Up>,
2339 add_pointer<_Up>>
2340 { };
2341
2342 template<typename _Up, size_t _Nm>
2343 struct __decay_selector<_Up[_Nm]>
2344 { using type = _Up*; };
2345
2346 template<typename _Up>
2347 struct __decay_selector<_Up[]>
2348 { using type = _Up*; };
2349
2350
2351
2352
2353 template<typename _Tp>
2355 { using type = typename __decay_selector<_Tp>::type; };
2356
2357 template<typename _Tp>
2358 struct decay<_Tp&>
2359 { using type = typename __decay_selector<_Tp>::type; };
2360
2361 template<typename _Tp>
2362 struct decay<_Tp&&>
2363 { using type = typename __decay_selector<_Tp>::type; };
2364#endif
2365
2366
2367
2368
2369 template<typename _Tp>
2370 struct __strip_reference_wrapper
2371 {
2372 using __type = _Tp;
2373 };
2374
2375 template<typename _Tp>
2376 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
2377 {
2378 using __type = _Tp&;
2379 };
2380
2381
2382 template<typename _Tp>
2383 using __decay_t = typename decay<_Tp>::type;
2384
2385 template<typename _Tp>
2386 using __decay_and_strip = __strip_reference_wrapper<__decay_t<_Tp>>;
2387
2388
2389
2390
2391
2392 template<typename... _Cond>
2393 using _Require = __enable_if_t<__and_<_Cond...>::value>;
2394
2395
2396 template<typename _Tp>
2397 using __remove_cvref_t
2398 = typename remove_cv<typename remove_reference<_Tp>::type>::type;
2399
2400
2401
2402
2403 template<bool _Cond, typename _Iftrue, typename _Iffalse>
2405 { using type = _Iftrue; };
2406
2407
2408 template<typename _Iftrue, typename _Iffalse>
2409 struct conditional<false, _Iftrue, _Iffalse>
2410 { using type = _Iffalse; };
2411
2412
2413 template<typename... _Tp>
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425 template<typename _Tp>
2426 struct __success_type
2427 { using type = _Tp; };
2428
2429 struct __failure_type
2430 { };
2431
2432 struct __do_common_type_impl
2433 {
2434 template<typename _Tp, typename _Up>
2435 using __cond_t
2436 = decltype(true ? std::declval<_Tp>() : std::declval<_Up>());
2437
2438
2439
2440 template<typename _Tp, typename _Up>
2441 static __success_type<__decay_t<__cond_t<_Tp, _Up>>>
2442 _S_test(int);
2443
2444#if __cplusplus > 201703L
2445
2446
2447 template<typename _Tp, typename _Up>
2448 static __success_type<__remove_cvref_t<__cond_t<const _Tp&, const _Up&>>>
2449 _S_test_2(int);
2450#endif
2451
2452 template<typename, typename>
2453 static __failure_type
2454 _S_test_2(...);
2455
2456 template<typename _Tp, typename _Up>
2457 static decltype(_S_test_2<_Tp, _Up>(0))
2458 _S_test(...);
2459 };
2460
2461
2462 template<>
2463 struct common_type<>
2464 { };
2465
2466
2467 template<typename _Tp0>
2468 struct common_type<_Tp0>
2469 : public common_type<_Tp0, _Tp0>
2470 { };
2471
2472
2473 template<typename _Tp1, typename _Tp2,
2474 typename _Dp1 = __decay_t<_Tp1>, typename _Dp2 = __decay_t<_Tp2>>
2475 struct __common_type_impl
2476 {
2477
2478
2479 using type = common_type<_Dp1, _Dp2>;
2480 };
2481
2482 template<typename _Tp1, typename _Tp2>
2483 struct __common_type_impl<_Tp1, _Tp2, _Tp1, _Tp2>
2484 : private __do_common_type_impl
2485 {
2486
2487
2488 using type = decltype(_S_test<_Tp1, _Tp2>(0));
2489 };
2490
2491
2492 template<typename _Tp1, typename _Tp2>
2493 struct common_type<_Tp1, _Tp2>
2494 : public __common_type_impl<_Tp1, _Tp2>::type
2495 { };
2496
2497 template<typename...>
2498 struct __common_type_pack
2499 { };
2500
2501 template<typename, typename, typename = void>
2502 struct __common_type_fold;
2503
2504
2505 template<typename _Tp1, typename _Tp2, typename... _Rp>
2506 struct common_type<_Tp1, _Tp2, _Rp...>
2507 : public __common_type_fold<common_type<_Tp1, _Tp2>,
2508 __common_type_pack<_Rp...>>
2509 { };
2510
2511
2512
2513
2514 template<typename _CTp, typename... _Rp>
2515 struct __common_type_fold<_CTp, __common_type_pack<_Rp...>,
2516 __void_t<typename _CTp::type>>
2517 : public common_type<typename _CTp::type, _Rp...>
2518 { };
2519
2520
2521 template<typename _CTp, typename _Rp>
2522 struct __common_type_fold<_CTp, _Rp, void>
2523 { };
2524
2525 template<typename _Tp, bool = __is_enum(_Tp)>
2526 struct __underlying_type_impl
2527 {
2528 using type = __underlying_type(_Tp);
2529 };
2530
2531 template<typename _Tp>
2532 struct __underlying_type_impl<_Tp, false>
2533 { };
2534
2535
2536
2537 template<typename _Tp>
2539 : public __underlying_type_impl<_Tp>
2540 { };
2541
2542
2543 template<typename _Tp>
2544 struct __declval_protector
2545 {
2546 static const bool __stop = false;
2547 };
2548
2549
2550
2551
2552
2553
2554 template<typename _Tp>
2555 auto declval() noexcept -> decltype(__declval<_Tp>(0))
2556 {
2557 static_assert(__declval_protector<_Tp>::__stop,
2558 "declval() must not be used!");
2559 return __declval<_Tp>(0);
2560 }
2561
2562
2563 template<typename _Signature>
2565
2566
2567
2568
2569 struct __invoke_memfun_ref { };
2570 struct __invoke_memfun_deref { };
2571 struct __invoke_memobj_ref { };
2572 struct __invoke_memobj_deref { };
2573 struct __invoke_other { };
2574
2575
2576 template<typename _Tp, typename _Tag>
2577 struct __result_of_success : __success_type<_Tp>
2578 { using __invoke_type = _Tag; };
2579
2580
2581 struct __result_of_memfun_ref_impl
2582 {
2583 template<typename _Fp, typename _Tp1, typename... _Args>
2584 static __result_of_success<decltype(
2585 (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
2586 ), __invoke_memfun_ref> _S_test(int);
2587
2588 template<typename...>
2589 static __failure_type _S_test(...);
2590 };
2591
2592 template<typename _MemPtr, typename _Arg, typename... _Args>
2593 struct __result_of_memfun_ref
2594 : private __result_of_memfun_ref_impl
2595 {
2596 using type = decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2597 };
2598
2599
2600 struct __result_of_memfun_deref_impl
2601 {
2602 template<typename _Fp, typename _Tp1, typename... _Args>
2603 static __result_of_success<decltype(
2604 ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
2605 ), __invoke_memfun_deref> _S_test(int);
2606
2607 template<typename...>
2608 static __failure_type _S_test(...);
2609 };
2610
2611 template<typename _MemPtr, typename _Arg, typename... _Args>
2612 struct __result_of_memfun_deref
2613 : private __result_of_memfun_deref_impl
2614 {
2615 using type = decltype(_S_test<_MemPtr, _Arg, _Args...>(0));
2616 };
2617
2618
2619 struct __result_of_memobj_ref_impl
2620 {
2621 template<typename _Fp, typename _Tp1>
2622 static __result_of_success<decltype(
2623 std::declval<_Tp1>().*std::declval<_Fp>()
2624 ), __invoke_memobj_ref> _S_test(int);
2625
2626 template<typename, typename>
2627 static __failure_type _S_test(...);
2628 };
2629
2630 template<typename _MemPtr, typename _Arg>
2631 struct __result_of_memobj_ref
2632 : private __result_of_memobj_ref_impl
2633 {
2634 using type = decltype(_S_test<_MemPtr, _Arg>(0));
2635 };
2636
2637
2638 struct __result_of_memobj_deref_impl
2639 {
2640 template<typename _Fp, typename _Tp1>
2641 static __result_of_success<decltype(
2642 (*std::declval<_Tp1>()).*std::declval<_Fp>()
2643 ), __invoke_memobj_deref> _S_test(int);
2644
2645 template<typename, typename>
2646 static __failure_type _S_test(...);
2647 };
2648
2649 template<typename _MemPtr, typename _Arg>
2650 struct __result_of_memobj_deref
2651 : private __result_of_memobj_deref_impl
2652 {
2653 using type = decltype(_S_test<_MemPtr, _Arg>(0));
2654 };
2655
2656 template<typename _MemPtr, typename _Arg>
2657 struct __result_of_memobj;
2658
2659 template<typename _Res, typename _Class, typename _Arg>
2660 struct __result_of_memobj<_Res _Class::*, _Arg>
2661 {
2662 using _Argval = __remove_cvref_t<_Arg>;
2663 using _MemPtr = _Res _Class::*;
2664 using type = typename __conditional_t<__or_<is_same<_Argval, _Class>,
2665 is_base_of<_Class, _Argval>>::value,
2666 __result_of_memobj_ref<_MemPtr, _Arg>,
2667 __result_of_memobj_deref<_MemPtr, _Arg>
2668 >::type;
2669 };
2670
2671 template<typename _MemPtr, typename _Arg, typename... _Args>
2672 struct __result_of_memfun;
2673
2674 template<typename _Res, typename _Class, typename _Arg, typename... _Args>
2675 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2676 {
2677 using _Argval = typename remove_reference<_Arg>::type;
2678 using _MemPtr = _Res _Class::*;
2679 using type = typename __conditional_t<is_base_of<_Class, _Argval>::value,
2680 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2681 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2682 >::type;
2683 };
2684
2685
2686
2687
2688
2689
2690 template<typename _Tp, typename _Up = __remove_cvref_t<_Tp>>
2691 struct __inv_unwrap
2692 {
2693 using type = _Tp;
2694 };
2695
2696 template<typename _Tp, typename _Up>
2697 struct __inv_unwrap<_Tp, reference_wrapper<_Up>>
2698 {
2699 using type = _Up&;
2700 };
2701
2702 template<bool, bool, typename _Functor, typename... _ArgTypes>
2703 struct __result_of_impl
2704 {
2705 using type = __failure_type;
2706 };
2707
2708 template<typename _MemPtr, typename _Arg>
2709 struct __result_of_impl<true, false, _MemPtr, _Arg>
2710 : public __result_of_memobj<__decay_t<_MemPtr>,
2711 typename __inv_unwrap<_Arg>::type>
2712 { };
2713
2714 template<typename _MemPtr, typename _Arg, typename... _Args>
2715 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2716 : public __result_of_memfun<__decay_t<_MemPtr>,
2717 typename __inv_unwrap<_Arg>::type, _Args...>
2718 { };
2719
2720
2721 struct __result_of_other_impl
2722 {
2723 template<typename _Fn, typename... _Args>
2724 static __result_of_success<decltype(
2725 std::declval<_Fn>()(std::declval<_Args>()...)
2726 ), __invoke_other> _S_test(int);
2727
2728 template<typename...>
2729 static __failure_type _S_test(...);
2730 };
2731
2732 template<typename _Functor, typename... _ArgTypes>
2733 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2734 : private __result_of_other_impl
2735 {
2736 using type = decltype(_S_test<_Functor, _ArgTypes...>(0));
2737 };
2738
2739
2740 template<typename _Functor, typename... _ArgTypes>
2741 struct __invoke_result
2742 : public __result_of_impl<
2743 is_member_object_pointer<
2744 typename remove_reference<_Functor>::type
2745 >::value,
2746 is_member_function_pointer<
2747 typename remove_reference<_Functor>::type
2748 >::value,
2749 _Functor, _ArgTypes...
2750 >::type
2751 { };
2752
2753
2754 template<typename _Fn, typename... _Args>
2755 using __invoke_result_t = typename __invoke_result<_Fn, _Args...>::type;
2756
2757
2758 template<typename _Functor, typename... _ArgTypes>
2759 struct result_of<_Functor(_ArgTypes...)>
2760 : public __invoke_result<_Functor, _ArgTypes...>
2761 { } _GLIBCXX17_DEPRECATED_SUGGEST("std::invoke_result");
2762
2763#if __cplusplus >= 201402L
2764#pragma GCC diagnostic push
2765#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2766
2767 template<size_t _Len, size_t _Align =
2768 __alignof__(typename __aligned_storage_msa<_Len>::__type)>
2770
2771 template <size_t _Len, typename... _Types>
2772 using aligned_union_t _GLIBCXX23_DEPRECATED = typename aligned_union<_Len, _Types...>::type;
2773#pragma GCC diagnostic pop
2774
2775
2776 template<typename _Tp>
2777 using decay_t = typename decay<_Tp>::type;
2778
2779
2780 template<bool _Cond, typename _Tp = void>
2782
2783
2784 template<bool _Cond, typename _Iftrue, typename _Iffalse>
2785 using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type;
2786
2787
2788 template<typename... _Tp>
2790
2791
2792 template<typename _Tp>
2794
2795
2796 template<typename _Tp>
2798#endif
2799
2800#ifdef __cpp_lib_void_t
2801
2802 template<typename...> using void_t = void;
2803#endif
2804
2805
2806
2807
2808
2809
2810#if __cpp_concepts
2811
2812 template<typename _Def, template<typename...> class _Op, typename... _Args>
2813 struct __detected_or
2814 {
2815 using type = _Def;
2817 };
2818
2819
2820 template<typename _Def, template<typename...> class _Op, typename... _Args>
2821 requires requires { typename _Op<_Args...>; }
2822 struct __detected_or<_Def, _Op, _Args...>
2823 {
2824 using type = _Op<_Args...>;
2825 using __is_detected = true_type;
2826 };
2827#else
2828
2829 template<typename _Default, typename _AlwaysVoid,
2830 template<typename...> class _Op, typename... _Args>
2831 struct __detector
2832 {
2833 using type = _Default;
2835 };
2836
2837
2838 template<typename _Default, template<typename...> class _Op,
2839 typename... _Args>
2840 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
2841 {
2842 using type = _Op<_Args...>;
2843 using __is_detected = true_type;
2844 };
2845
2846 template<typename _Default, template<typename...> class _Op,
2847 typename... _Args>
2848 using __detected_or = __detector<_Default, void, _Op, _Args...>;
2849#endif
2850
2851
2852 template<typename _Default, template<typename...> class _Op,
2853 typename... _Args>
2854 using __detected_or_t
2855 = typename __detected_or<_Default, _Op, _Args...>::type;
2856
2857
2858
2859
2860
2861#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
2862 template<typename _Tp, typename = __void_t<>> \
2863 struct __has_##_NTYPE \
2864 : false_type \
2865 { }; \
2866 template<typename _Tp> \
2867 struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
2868 : true_type \
2869 { };
2870
2871 template <typename _Tp>
2872 struct __is_swappable;
2873
2874 template <typename _Tp>
2875 struct __is_nothrow_swappable;
2876
2877 template<typename>
2878 struct __is_tuple_like_impl : false_type
2879 { };
2880
2881
2882 template<typename _Tp>
2883 struct __is_tuple_like
2884 : public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type
2885 { };
2886
2887
2888 template<typename _Tp>
2889 _GLIBCXX20_CONSTEXPR
2890 inline
2891 _Require<__not_<__is_tuple_like<_Tp>>,
2892 is_move_constructible<_Tp>,
2893 is_move_assignable<_Tp>>
2894 swap(_Tp&, _Tp&)
2895 noexcept(__and_<is_nothrow_move_constructible<_Tp>,
2896 is_nothrow_move_assignable<_Tp>>::value);
2897
2898 template<typename _Tp, size_t _Nm>
2899 _GLIBCXX20_CONSTEXPR
2900 inline
2901 __enable_if_t<__is_swappable<_Tp>::value>
2902 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
2903 noexcept(__is_nothrow_swappable<_Tp>::value);
2904
2905
2906 namespace __swappable_details {
2907 using std::swap;
2908
2909 struct __do_is_swappable_impl
2910 {
2911 template<typename _Tp, typename
2912 = decltype(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
2913 static true_type __test(int);
2914
2915 template<typename>
2917 };
2918
2919 struct __do_is_nothrow_swappable_impl
2920 {
2921 template<typename _Tp>
2922 static __bool_constant<
2923 noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
2924 > __test(int);
2925
2926 template<typename>
2928 };
2929
2930 }
2931
2932 template<typename _Tp>
2933 struct __is_swappable_impl
2934 : public __swappable_details::__do_is_swappable_impl
2935 {
2936 using type = decltype(__test<_Tp>(0));
2937 };
2938
2939 template<typename _Tp>
2940 struct __is_nothrow_swappable_impl
2941 : public __swappable_details::__do_is_nothrow_swappable_impl
2942 {
2943 using type = decltype(__test<_Tp>(0));
2944 };
2945
2946 template<typename _Tp>
2947 struct __is_swappable
2948 : public __is_swappable_impl<_Tp>::type
2949 { };
2950
2951 template<typename _Tp>
2952 struct __is_nothrow_swappable
2953 : public __is_nothrow_swappable_impl<_Tp>::type
2954 { };
2955
2956
2957#ifdef __cpp_lib_is_swappable
2958
2959
2960
2961 template<typename _Tp>
2962 struct is_swappable
2963 : public __is_swappable_impl<_Tp>::type
2964 {
2965 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
2966 "template argument must be a complete class or an unbounded array");
2967 };
2968
2969
2970 template<typename _Tp>
2971 struct is_nothrow_swappable
2972 : public __is_nothrow_swappable_impl<_Tp>::type
2973 {
2974 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
2975 "template argument must be a complete class or an unbounded array");
2976 };
2977
2978#if __cplusplus >= 201402L
2979
2980 template<typename _Tp>
2981 _GLIBCXX17_INLINE constexpr bool is_swappable_v =
2982 is_swappable<_Tp>::value;
2983
2984
2985 template<typename _Tp>
2986 _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_v =
2987 is_nothrow_swappable<_Tp>::value;
2988#endif
2989
2990
2991 namespace __swappable_with_details {
2992 using std::swap;
2993
2994 struct __do_is_swappable_with_impl
2995 {
2996 template<typename _Tp, typename _Up, typename
2997 = decltype(swap(std::declval<_Tp>(), std::declval<_Up>())),
2998 typename
2999 = decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))>
3001
3002 template<typename, typename>
3004 };
3005
3006 struct __do_is_nothrow_swappable_with_impl
3007 {
3008 template<typename _Tp, typename _Up>
3009 static __bool_constant<
3010 noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))
3011 &&
3012 noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()))
3013 > __test(int);
3014
3015 template<typename, typename>
3017 };
3018
3019 }
3020
3021 template<typename _Tp, typename _Up>
3022 struct __is_swappable_with_impl
3023 : public __swappable_with_details::__do_is_swappable_with_impl
3024 {
3025 using type = decltype(__test<_Tp, _Up>(0));
3026 };
3027
3028
3029 template<typename _Tp>
3030 struct __is_swappable_with_impl<_Tp&, _Tp&>
3031 : public __swappable_details::__do_is_swappable_impl
3032 {
3033 using type = decltype(__test<_Tp&>(0));
3034 };
3035
3036 template<typename _Tp, typename _Up>
3037 struct __is_nothrow_swappable_with_impl
3038 : public __swappable_with_details::__do_is_nothrow_swappable_with_impl
3039 {
3040 using type = decltype(__test<_Tp, _Up>(0));
3041 };
3042
3043
3044 template<typename _Tp>
3045 struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
3046 : public __swappable_details::__do_is_nothrow_swappable_impl
3047 {
3048 using type = decltype(__test<_Tp&>(0));
3049 };
3050
3051
3052
3053 template<typename _Tp, typename _Up>
3054 struct is_swappable_with
3055 : public __is_swappable_with_impl<_Tp, _Up>::type
3056 {
3057 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3058 "first template argument must be a complete class or an unbounded array");
3059 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3060 "second template argument must be a complete class or an unbounded array");
3061 };
3062
3063
3064 template<typename _Tp, typename _Up>
3065 struct is_nothrow_swappable_with
3066 : public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
3067 {
3068 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3069 "first template argument must be a complete class or an unbounded array");
3070 static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3071 "second template argument must be a complete class or an unbounded array");
3072 };
3073
3074#if __cplusplus >= 201402L
3075
3076 template<typename _Tp, typename _Up>
3077 _GLIBCXX17_INLINE constexpr bool is_swappable_with_v =
3078 is_swappable_with<_Tp, _Up>::value;
3079
3080
3081 template<typename _Tp, typename _Up>
3082 _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_with_v =
3083 is_nothrow_swappable_with<_Tp, _Up>::value;
3084#endif
3085
3086#endif
3087
3088
3089
3090
3091
3092
3093 template<typename _Result, typename _Ret,
3094 bool = is_void<_Ret>::value, typename = void>
3095 struct __is_invocable_impl
3097 {
3098 using __nothrow_conv = false_type;
3099 };
3100
3101
3102 template<typename _Result, typename _Ret>
3103 struct __is_invocable_impl<_Result, _Ret,
3104 true,
3105 __void_t<typename _Result::type>>
3107 {
3108 using __nothrow_conv = true_type;
3109 };
3110
3111#pragma GCC diagnostic push
3112#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3113
3114 template<typename _Result, typename _Ret>
3115 struct __is_invocable_impl<_Result, _Ret,
3116 false,
3117 __void_t<typename _Result::type>>
3118 {
3119 private:
3120
3121 using _Res_t = typename _Result::type;
3122
3123
3124
3125 static _Res_t _S_get() noexcept;
3126
3127
3128 template<typename _Tp>
3129 static void _S_conv(__type_identity_t<_Tp>) noexcept;
3130
3131
3132 template<typename _Tp,
3133 bool _Nothrow = noexcept(_S_conv<_Tp>(_S_get())),
3134 typename = decltype(_S_conv<_Tp>(_S_get())),
3135#if __has_builtin(__reference_converts_from_temporary)
3136 bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)
3137#else
3138 bool _Dangle = false
3139#endif
3140 >
3141 static __bool_constant<_Nothrow && !_Dangle>
3142 _S_test(int);
3143
3144 template<typename _Tp, bool = false>
3146 _S_test(...);
3147
3148 public:
3149
3150 using type = decltype(_S_test<_Ret, true>(1));
3151
3152
3153 using __nothrow_conv = decltype(_S_test<_Ret>(1));
3154 };
3155#pragma GCC diagnostic pop
3156
3157 template<typename _Fn, typename... _ArgTypes>
3158 struct __is_invocable
3159 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3160 { };
3161
3162 template<typename _Fn, typename _Tp, typename... _Args>
3163 constexpr bool __call_is_nt(__invoke_memfun_ref)
3164 {
3165 using _Up = typename __inv_unwrap<_Tp>::type;
3166 return noexcept((std::declval<_Up>().*std::declval<_Fn>())(
3167 std::declval<_Args>()...));
3168 }
3169
3170 template<typename _Fn, typename _Tp, typename... _Args>
3171 constexpr bool __call_is_nt(__invoke_memfun_deref)
3172 {
3173 return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())(
3174 std::declval<_Args>()...));
3175 }
3176
3177 template<typename _Fn, typename _Tp>
3178 constexpr bool __call_is_nt(__invoke_memobj_ref)
3179 {
3180 using _Up = typename __inv_unwrap<_Tp>::type;
3181 return noexcept(std::declval<_Up>().*std::declval<_Fn>());
3182 }
3183
3184 template<typename _Fn, typename _Tp>
3185 constexpr bool __call_is_nt(__invoke_memobj_deref)
3186 {
3187 return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>());
3188 }
3189
3190 template<typename _Fn, typename... _Args>
3191 constexpr bool __call_is_nt(__invoke_other)
3192 {
3193 return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
3194 }
3195
3196 template<typename _Result, typename _Fn, typename... _Args>
3197 struct __call_is_nothrow
3198 : __bool_constant<
3199 std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
3200 >
3201 { };
3202
3203 template<typename _Fn, typename... _Args>
3204 using __call_is_nothrow_
3205 = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
3206
3207
3208 template<typename _Fn, typename... _Args>
3209 struct __is_nothrow_invocable
3210 : __and_<__is_invocable<_Fn, _Args...>,
3211 __call_is_nothrow_<_Fn, _Args...>>::type
3212 { };
3213
3214#pragma GCC diagnostic push
3215#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
3216 struct __nonesuchbase {};
3217 struct __nonesuch : private __nonesuchbase {
3218 ~__nonesuch() = delete;
3219 __nonesuch(__nonesuch const&) = delete;
3220 void operator=(__nonesuch const&) = delete;
3221 };
3222#pragma GCC diagnostic pop
3223
3224
3225#ifdef __cpp_lib_is_invocable
3226
3227 template<typename _Functor, typename... _ArgTypes>
3228 struct invoke_result
3229 : public __invoke_result<_Functor, _ArgTypes...>
3230 {
3231 static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
3232 "_Functor must be a complete class or an unbounded array");
3233 static_assert((std::__is_complete_or_unbounded(
3234 __type_identity<_ArgTypes>{}) && ...),
3235 "each argument type must be a complete class or an unbounded array");
3236 };
3237
3238
3239 template<typename _Fn, typename... _Args>
3240 using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
3241
3242
3243 template<typename _Fn, typename... _ArgTypes>
3244 struct is_invocable
3245#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
3246 : public __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
3247#else
3248 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
3249#endif
3250 {
3251 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3252 "_Fn must be a complete class or an unbounded array");
3253 static_assert((std::__is_complete_or_unbounded(
3254 __type_identity<_ArgTypes>{}) && ...),
3255 "each argument type must be a complete class or an unbounded array");
3256 };
3257
3258
3259 template<typename _Ret, typename _Fn, typename... _ArgTypes>
3260 struct is_invocable_r
3261 : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
3262 {
3263 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3264 "_Fn must be a complete class or an unbounded array");
3265 static_assert((std::__is_complete_or_unbounded(
3266 __type_identity<_ArgTypes>{}) && ...),
3267 "each argument type must be a complete class or an unbounded array");
3268 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3269 "_Ret must be a complete class or an unbounded array");
3270 };
3271
3272
3273 template<typename _Fn, typename... _ArgTypes>
3274 struct is_nothrow_invocable
3275#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable)
3276 : public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)>
3277#else
3278 : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
3279 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3280#endif
3281 {
3282 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3283 "_Fn must be a complete class or an unbounded array");
3284 static_assert((std::__is_complete_or_unbounded(
3285 __type_identity<_ArgTypes>{}) && ...),
3286 "each argument type must be a complete class or an unbounded array");
3287 };
3288
3289
3290
3291
3292
3293 template<typename _Result, typename _Ret>
3294 using __is_nt_invocable_impl
3295 = typename __is_invocable_impl<_Result, _Ret>::__nothrow_conv;
3296
3297
3298
3299 template<typename _Ret, typename _Fn, typename... _ArgTypes>
3300 struct is_nothrow_invocable_r
3301 : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
3302 __call_is_nothrow_<_Fn, _ArgTypes...>>::type
3303 {
3304 static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
3305 "_Fn must be a complete class or an unbounded array");
3306 static_assert((std::__is_complete_or_unbounded(
3307 __type_identity<_ArgTypes>{}) && ...),
3308 "each argument type must be a complete class or an unbounded array");
3309 static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
3310 "_Ret must be a complete class or an unbounded array");
3311 };
3312#endif
3313
3314#if __cpp_lib_type_trait_variable_templates
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329template <typename _Tp>
3330 inline constexpr bool is_void_v = is_void<_Tp>::value;
3331template <typename _Tp>
3332 inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
3333template <typename _Tp>
3334 inline constexpr bool is_integral_v = is_integral<_Tp>::value;
3335template <typename _Tp>
3336 inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
3337
3338#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
3339template <typename _Tp>
3340 inline constexpr bool is_array_v = __is_array(_Tp);
3341#else
3342template <typename _Tp>
3343 inline constexpr bool is_array_v = false;
3344template <typename _Tp>
3345 inline constexpr bool is_array_v<_Tp[]> = true;
3346template <typename _Tp, size_t _Num>
3347 inline constexpr bool is_array_v<_Tp[_Num]> = true;
3348#endif
3349
3350#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
3351template <typename _Tp>
3352 inline constexpr bool is_pointer_v = __is_pointer(_Tp);
3353#else
3354template <typename _Tp>
3355 inline constexpr bool is_pointer_v = false;
3356template <typename _Tp>
3357 inline constexpr bool is_pointer_v<_Tp*> = true;
3358template <typename _Tp>
3359 inline constexpr bool is_pointer_v<_Tp* const> = true;
3360template <typename _Tp>
3361 inline constexpr bool is_pointer_v<_Tp* volatile> = true;
3362template <typename _Tp>
3363 inline constexpr bool is_pointer_v<_Tp* const volatile> = true;
3364#endif
3365
3366template <typename _Tp>
3367 inline constexpr bool is_lvalue_reference_v = false;
3368template <typename _Tp>
3369 inline constexpr bool is_lvalue_reference_v<_Tp&> = true;
3370template <typename _Tp>
3371 inline constexpr bool is_rvalue_reference_v = false;
3372template <typename _Tp>
3373 inline constexpr bool is_rvalue_reference_v<_Tp&&> = true;
3374
3375#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer)
3376template <typename _Tp>
3377 inline constexpr bool is_member_object_pointer_v =
3378 __is_member_object_pointer(_Tp);
3379#else
3380template <typename _Tp>
3381 inline constexpr bool is_member_object_pointer_v =
3382 is_member_object_pointer<_Tp>::value;
3383#endif
3384
3385#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer)
3386template <typename _Tp>
3387 inline constexpr bool is_member_function_pointer_v =
3388 __is_member_function_pointer(_Tp);
3389#else
3390template <typename _Tp>
3391 inline constexpr bool is_member_function_pointer_v =
3392 is_member_function_pointer<_Tp>::value;
3393#endif
3394
3395template <typename _Tp>
3396 inline constexpr bool is_enum_v = __is_enum(_Tp);
3397template <typename _Tp>
3398 inline constexpr bool is_union_v = __is_union(_Tp);
3399template <typename _Tp>
3400 inline constexpr bool is_class_v = __is_class(_Tp);
3401
3402
3403#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference)
3404template <typename _Tp>
3405 inline constexpr bool is_reference_v = __is_reference(_Tp);
3406#else
3407template <typename _Tp>
3408 inline constexpr bool is_reference_v = false;
3409template <typename _Tp>
3410 inline constexpr bool is_reference_v<_Tp&> = true;
3411template <typename _Tp>
3412 inline constexpr bool is_reference_v<_Tp&&> = true;
3413#endif
3414
3415template <typename _Tp>
3416 inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
3417template <typename _Tp>
3418 inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
3419
3420#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
3421template <typename _Tp>
3422 inline constexpr bool is_object_v = __is_object(_Tp);
3423#else
3424template <typename _Tp>
3425 inline constexpr bool is_object_v = is_object<_Tp>::value;
3426#endif
3427
3428template <typename _Tp>
3429 inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
3430template <typename _Tp>
3431 inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
3432
3433#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
3434template <typename _Tp>
3435 inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
3436#else
3437template <typename _Tp>
3438 inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
3439#endif
3440
3441#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const)
3442template <typename _Tp>
3443 inline constexpr bool is_const_v = __is_const(_Tp);
3444#else
3445template <typename _Tp>
3446 inline constexpr bool is_const_v = false;
3447template <typename _Tp>
3448 inline constexpr bool is_const_v<const _Tp> = true;
3449#endif
3450
3451#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function)
3452template <typename _Tp>
3453 inline constexpr bool is_function_v = __is_function(_Tp);
3454#else
3455template <typename _Tp>
3456 inline constexpr bool is_function_v = !is_const_v<const _Tp>;
3457template <typename _Tp>
3458 inline constexpr bool is_function_v<_Tp&> = false;
3459template <typename _Tp>
3460 inline constexpr bool is_function_v<_Tp&&> = false;
3461#endif
3462
3463#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile)
3464template <typename _Tp>
3465 inline constexpr bool is_volatile_v = __is_volatile(_Tp);
3466#else
3467template <typename _Tp>
3468 inline constexpr bool is_volatile_v = false;
3469template <typename _Tp>
3470 inline constexpr bool is_volatile_v<volatile _Tp> = true;
3471#endif
3472
3473template <typename _Tp>
3474 inline constexpr bool is_trivial_v = __is_trivial(_Tp);
3475template <typename _Tp>
3476 inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
3477template <typename _Tp>
3478 inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp);
3479template <typename _Tp>
3480 _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout_v && is_trivial_v")
3481 inline constexpr bool is_pod_v = __is_pod(_Tp);
3482template <typename _Tp>
3483 _GLIBCXX17_DEPRECATED
3484 inline constexpr bool is_literal_type_v = __is_literal_type(_Tp);
3485template <typename _Tp>
3486 inline constexpr bool is_empty_v = __is_empty(_Tp);
3487template <typename _Tp>
3488 inline constexpr bool is_polymorphic_v = __is_polymorphic(_Tp);
3489template <typename _Tp>
3490 inline constexpr bool is_abstract_v = __is_abstract(_Tp);
3491template <typename _Tp>
3492 inline constexpr bool is_final_v = __is_final(_Tp);
3493
3494template <typename _Tp>
3495 inline constexpr bool is_signed_v = is_signed<_Tp>::value;
3496template <typename _Tp>
3497 inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
3498
3499template <typename _Tp, typename... _Args>
3500 inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...);
3501template <typename _Tp>
3502 inline constexpr bool is_default_constructible_v = __is_constructible(_Tp);
3503template <typename _Tp>
3504 inline constexpr bool is_copy_constructible_v
3505 = __is_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3506template <typename _Tp>
3507 inline constexpr bool is_move_constructible_v
3508 = __is_constructible(_Tp, __add_rval_ref_t<_Tp>);
3509
3510template <typename _Tp, typename _Up>
3511 inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Up);
3512template <typename _Tp>
3513 inline constexpr bool is_copy_assignable_v
3514 = __is_assignable(__add_lval_ref_t<_Tp>, __add_lval_ref_t<const _Tp>);
3515template <typename _Tp>
3516 inline constexpr bool is_move_assignable_v
3517 = __is_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3518
3519template <typename _Tp>
3520 inline constexpr bool is_destructible_v = is_destructible<_Tp>::value;
3521
3522template <typename _Tp, typename... _Args>
3523 inline constexpr bool is_trivially_constructible_v
3524 = __is_trivially_constructible(_Tp, _Args...);
3525template <typename _Tp>
3526 inline constexpr bool is_trivially_default_constructible_v
3527 = __is_trivially_constructible(_Tp);
3528template <typename _Tp>
3529 inline constexpr bool is_trivially_copy_constructible_v
3530 = __is_trivially_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3531template <typename _Tp>
3532 inline constexpr bool is_trivially_move_constructible_v
3533 = __is_trivially_constructible(_Tp, __add_rval_ref_t<_Tp>);
3534
3535template <typename _Tp, typename _Up>
3536 inline constexpr bool is_trivially_assignable_v
3537 = __is_trivially_assignable(_Tp, _Up);
3538template <typename _Tp>
3539 inline constexpr bool is_trivially_copy_assignable_v
3540 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3541 __add_lval_ref_t<const _Tp>);
3542template <typename _Tp>
3543 inline constexpr bool is_trivially_move_assignable_v
3544 = __is_trivially_assignable(__add_lval_ref_t<_Tp>,
3545 __add_rval_ref_t<_Tp>);
3546
3547#if __cpp_concepts
3548template <typename _Tp>
3549 inline constexpr bool is_trivially_destructible_v = false;
3550
3551template <typename _Tp>
3552 requires (!is_reference_v<_Tp>) && requires (_Tp& __t) { __t.~_Tp(); }
3553 inline constexpr bool is_trivially_destructible_v<_Tp>
3554 = __has_trivial_destructor(_Tp);
3555template <typename _Tp>
3556 inline constexpr bool is_trivially_destructible_v<_Tp&> = true;
3557template <typename _Tp>
3558 inline constexpr bool is_trivially_destructible_v<_Tp&&> = true;
3559template <typename _Tp, size_t _Nm>
3560 inline constexpr bool is_trivially_destructible_v<_Tp[_Nm]>
3561 = is_trivially_destructible_v<_Tp>;
3562#else
3563template <typename _Tp>
3564 inline constexpr bool is_trivially_destructible_v =
3565 is_trivially_destructible<_Tp>::value;
3566#endif
3567
3568template <typename _Tp, typename... _Args>
3569 inline constexpr bool is_nothrow_constructible_v
3570 = __is_nothrow_constructible(_Tp, _Args...);
3571template <typename _Tp>
3572 inline constexpr bool is_nothrow_default_constructible_v
3573 = __is_nothrow_constructible(_Tp);
3574template <typename _Tp>
3575 inline constexpr bool is_nothrow_copy_constructible_v
3576 = __is_nothrow_constructible(_Tp, __add_lval_ref_t<const _Tp>);
3577template <typename _Tp>
3578 inline constexpr bool is_nothrow_move_constructible_v
3579 = __is_nothrow_constructible(_Tp, __add_rval_ref_t<_Tp>);
3580
3581template <typename _Tp, typename _Up>
3582 inline constexpr bool is_nothrow_assignable_v
3583 = __is_nothrow_assignable(_Tp, _Up);
3584template <typename _Tp>
3585 inline constexpr bool is_nothrow_copy_assignable_v
3586 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>,
3587 __add_lval_ref_t<const _Tp>);
3588template <typename _Tp>
3589 inline constexpr bool is_nothrow_move_assignable_v
3590 = __is_nothrow_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>);
3591
3592template <typename _Tp>
3593 inline constexpr bool is_nothrow_destructible_v =
3594 is_nothrow_destructible<_Tp>::value;
3595
3596template <typename _Tp>
3597 inline constexpr bool has_virtual_destructor_v
3598 = __has_virtual_destructor(_Tp);
3599
3600template <typename _Tp>
3601 inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
3602
3603#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank)
3604template <typename _Tp>
3605 inline constexpr size_t rank_v = __array_rank(_Tp);
3606#else
3607template <typename _Tp>
3608 inline constexpr size_t rank_v = 0;
3609template <typename _Tp, size_t _Size>
3610 inline constexpr size_t rank_v<_Tp[_Size]> = 1 + rank_v<_Tp>;
3611template <typename _Tp>
3612 inline constexpr size_t rank_v<_Tp[]> = 1 + rank_v<_Tp>;
3613#endif
3614
3615template <typename _Tp, unsigned _Idx = 0>
3616 inline constexpr size_t extent_v = 0;
3617template <typename _Tp, size_t _Size>
3618 inline constexpr size_t extent_v<_Tp[_Size], 0> = _Size;
3619template <typename _Tp, unsigned _Idx, size_t _Size>
3620 inline constexpr size_t extent_v<_Tp[_Size], _Idx> = extent_v<_Tp, _Idx - 1>;
3621template <typename _Tp>
3622 inline constexpr size_t extent_v<_Tp[], 0> = 0;
3623template <typename _Tp, unsigned _Idx>
3624 inline constexpr size_t extent_v<_Tp[], _Idx> = extent_v<_Tp, _Idx - 1>;
3625
3626#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
3627template <typename _Tp, typename _Up>
3628 inline constexpr bool is_same_v = __is_same(_Tp, _Up);
3629#else
3630template <typename _Tp, typename _Up>
3631 inline constexpr bool is_same_v = false;
3632template <typename _Tp>
3633 inline constexpr bool is_same_v<_Tp, _Tp> = true;
3634#endif
3635template <typename _Base, typename _Derived>
3636 inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
3637#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible)
3638template <typename _From, typename _To>
3639 inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
3640#else
3641template <typename _From, typename _To>
3642 inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
3643#endif
3644template<typename _Fn, typename... _Args>
3645 inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
3646template<typename _Fn, typename... _Args>
3647 inline constexpr bool is_nothrow_invocable_v
3648 = is_nothrow_invocable<_Fn, _Args...>::value;
3649template<typename _Ret, typename _Fn, typename... _Args>
3650 inline constexpr bool is_invocable_r_v
3651 = is_invocable_r<_Ret, _Fn, _Args...>::value;
3652template<typename _Ret, typename _Fn, typename... _Args>
3653 inline constexpr bool is_nothrow_invocable_r_v
3654 = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
3655
3656#endif
3657
3658#ifdef __cpp_lib_has_unique_object_representations
3659
3660
3661 template<typename _Tp>
3662 struct has_unique_object_representations
3663 : bool_constant<__has_unique_object_representations(
3664 remove_cv_t<remove_all_extents_t<_Tp>>
3665 )>
3666 {
3667 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
3668 "template argument must be a complete class or an unbounded array");
3669 };
3670
3671# if __cpp_lib_type_trait_variable_templates
3672
3673 template<typename _Tp>
3674 inline constexpr bool has_unique_object_representations_v
3675 = has_unique_object_representations<_Tp>::value;
3676# endif
3677#endif
3678
3679#ifdef __cpp_lib_is_aggregate
3680
3681
3682 template<typename _Tp>
3683 struct is_aggregate
3684 : bool_constant<__is_aggregate(remove_cv_t<_Tp>)>
3685 { };
3686
3687# if __cpp_lib_type_trait_variable_templates
3688
3689
3690
3691
3692 template<typename _Tp>
3693 inline constexpr bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>);
3694# endif
3695#endif
3696
3697
3698
3699
3700
3701#ifdef __cpp_lib_remove_cvref
3702# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref)
3703 template<typename _Tp>
3704 struct remove_cvref
3705 { using type = __remove_cvref(_Tp); };
3706# else
3707 template<typename _Tp>
3708 struct remove_cvref
3709 { using type = typename remove_cv<_Tp>::type; };
3710
3711 template<typename _Tp>
3712 struct remove_cvref<_Tp&>
3713 { using type = typename remove_cv<_Tp>::type; };
3714
3715 template<typename _Tp>
3716 struct remove_cvref<_Tp&&>
3717 { using type = typename remove_cv<_Tp>::type; };
3718# endif
3719
3720 template<typename _Tp>
3721 using remove_cvref_t = typename remove_cvref<_Tp>::type;
3722
3723#endif
3724
3725#ifdef __cpp_lib_type_identity
3726
3727
3728
3729
3730 template<typename _Tp>
3731 struct type_identity { using type = _Tp; };
3732
3733 template<typename _Tp>
3734 using type_identity_t = typename type_identity<_Tp>::type;
3735
3736#endif
3737
3738#ifdef __cpp_lib_unwrap_ref
3739
3740
3741
3742
3743 template<typename _Tp>
3744 struct unwrap_reference { using type = _Tp; };
3745
3746 template<typename _Tp>
3747 struct unwrap_reference<reference_wrapper<_Tp>> { using type = _Tp&; };
3748
3749 template<typename _Tp>
3750 using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
3751
3752
3753
3754
3755
3756
3757 template<typename _Tp>
3758 struct unwrap_ref_decay { using type = unwrap_reference_t<decay_t<_Tp>>; };
3759
3760 template<typename _Tp>
3761 using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
3762
3763#endif
3764
3765#ifdef __cpp_lib_bounded_array_traits
3766
3767
3768
3769# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_bounded_array)
3770 template<typename _Tp>
3771 inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
3772# else
3773 template<typename _Tp>
3774 inline constexpr bool is_bounded_array_v = false;
3775
3776 template<typename _Tp, size_t _Size>
3777 inline constexpr bool is_bounded_array_v<_Tp[_Size]> = true;
3778# endif
3779
3780
3781
3782
3783# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unbounded_array)
3784 template<typename _Tp>
3785 inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp);
3786# else
3787 template<typename _Tp>
3788 inline constexpr bool is_unbounded_array_v = false;
3789
3790 template<typename _Tp>
3791 inline constexpr bool is_unbounded_array_v<_Tp[]> = true;
3792# endif
3793
3794
3795
3796 template<typename _Tp>
3797 struct is_bounded_array
3798 : public bool_constant<is_bounded_array_v<_Tp>>
3799 { };
3800
3801
3802
3803 template<typename _Tp>
3804 struct is_unbounded_array
3805 : public bool_constant<is_unbounded_array_v<_Tp>>
3806 { };
3807#endif
3808
3809#if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L
3810
3811
3812 template<typename _Tp, typename _Up>
3814 : bool_constant<__is_layout_compatible(_Tp, _Up)>
3815 { };
3816
3817
3818
3819 template<typename _Tp, typename _Up>
3821 = __is_layout_compatible(_Tp, _Up);
3822
3823#if __has_builtin(__builtin_is_corresponding_member)
3824# ifndef __cpp_lib_is_layout_compatible
3825# error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set"
3826# endif
3827
3828
3829 template<typename _S1, typename _S2, typename _M1, typename _M2>
3830 constexpr bool
3832 { return __builtin_is_corresponding_member(__m1, __m2); }
3833#endif
3834#endif
3835
3836#if __has_builtin(__is_pointer_interconvertible_base_of) \
3837 && __cplusplus >= 202002L
3838
3839
3840 template<typename _Base, typename _Derived>
3842 : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)>
3843 { };
3844
3845
3846
3847 template<typename _Base, typename _Derived>
3849 = __is_pointer_interconvertible_base_of(_Base, _Derived);
3850
3851#if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
3852# ifndef __cpp_lib_is_pointer_interconvertible
3853# error "libstdc++ bug: is_pointer_interconvertible available but FTM is not set"
3854# endif
3855
3856
3857
3858
3859 template<typename _Tp, typename _Mem>
3860 constexpr bool
3862 { return __builtin_is_pointer_interconvertible_with_class(__mp); }
3863#endif
3864#endif
3865
3866#ifdef __cpp_lib_is_scoped_enum
3867
3868
3869
3870# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
3871 template<typename _Tp>
3872 struct is_scoped_enum
3873 : bool_constant<__is_scoped_enum(_Tp)>
3874 { };
3875# else
3876 template<typename _Tp>
3877 struct is_scoped_enum
3879 { };
3880
3881 template<typename _Tp>
3882 requires __is_enum(_Tp)
3883 && requires(remove_cv_t<_Tp> __t) { __t = __t; }
3884 struct is_scoped_enum<_Tp>
3885 : bool_constant<!requires(_Tp __t, void(*__f)(int)) { __f(__t); }>
3886 { };
3887# endif
3888
3889
3890
3891# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
3892 template<typename _Tp>
3893 inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
3894# else
3895 template<typename _Tp>
3896 inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
3897# endif
3898#endif
3899
3900#ifdef __cpp_lib_reference_from_temporary
3901
3902
3903
3904
3905 template<typename _Tp, typename _Up>
3906 struct reference_constructs_from_temporary
3907 : public bool_constant<__reference_constructs_from_temporary(_Tp, _Up)>
3908 {
3909 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
3910 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3911 "template argument must be a complete class or an unbounded array");
3912 };
3913
3914
3915
3916
3917
3918 template<typename _Tp, typename _Up>
3919 struct reference_converts_from_temporary
3920 : public bool_constant<__reference_converts_from_temporary(_Tp, _Up)>
3921 {
3922 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{})
3923 && std::__is_complete_or_unbounded(__type_identity<_Up>{}),
3924 "template argument must be a complete class or an unbounded array");
3925 };
3926
3927
3928
3929 template<typename _Tp, typename _Up>
3930 inline constexpr bool reference_constructs_from_temporary_v
3931 = reference_constructs_from_temporary<_Tp, _Up>::value;
3932
3933
3934
3935 template<typename _Tp, typename _Up>
3936 inline constexpr bool reference_converts_from_temporary_v
3937 = reference_converts_from_temporary<_Tp, _Up>::value;
3938#endif
3939
3940#ifdef __cpp_lib_is_constant_evaluated
3941
3942
3943 constexpr inline bool
3944 is_constant_evaluated() noexcept
3945 {
3946#if __cpp_if_consteval >= 202106L
3947 if consteval { return true; } else { return false; }
3948#else
3949 return __builtin_is_constant_evaluated();
3950#endif
3951 }
3952#endif
3953
3954#if __cplusplus >= 202002L
3955
3956 template<typename _From, typename _To>
3957 using __copy_cv = typename __match_cv_qualifiers<_From, _To>::__type;
3958
3959 template<typename _Xp, typename _Yp>
3960 using __cond_res
3961 = decltype(false ? declval<_Xp(&)()>()() : declval<_Yp(&)()>()());
3962
3963 template<typename _Ap, typename _Bp, typename = void>
3964 struct __common_ref_impl
3965 { };
3966
3967
3968 template<typename _Ap, typename _Bp>
3969 using __common_ref = typename __common_ref_impl<_Ap, _Bp>::type;
3970
3971
3972 template<typename _Xp, typename _Yp>
3973 using __condres_cvref
3974 = __cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>;
3975
3976
3977 template<typename _Xp, typename _Yp>
3978 struct __common_ref_impl<_Xp&, _Yp&, __void_t<__condres_cvref<_Xp, _Yp>>>
3979 : enable_if<is_reference_v<__condres_cvref<_Xp, _Yp>>,
3980 __condres_cvref<_Xp, _Yp>>
3981 { };
3982
3983
3984 template<typename _Xp, typename _Yp>
3985 using __common_ref_C = remove_reference_t<__common_ref<_Xp&, _Yp&>>&&;
3986
3987
3988 template<typename _Xp, typename _Yp>
3989 struct __common_ref_impl<_Xp&&, _Yp&&,
3990 _Require<is_convertible<_Xp&&, __common_ref_C<_Xp, _Yp>>,
3991 is_convertible<_Yp&&, __common_ref_C<_Xp, _Yp>>>>
3992 { using type = __common_ref_C<_Xp, _Yp>; };
3993
3994
3995 template<typename _Xp, typename _Yp>
3996 using __common_ref_D = __common_ref<const _Xp&, _Yp&>;
3997
3998
3999 template<typename _Xp, typename _Yp>
4000 struct __common_ref_impl<_Xp&&, _Yp&,
4001 _Require<is_convertible<_Xp&&, __common_ref_D<_Xp, _Yp>>>>
4002 { using type = __common_ref_D<_Xp, _Yp>; };
4003
4004
4005 template<typename _Xp, typename _Yp>
4006 struct __common_ref_impl<_Xp&, _Yp&&>
4007 : __common_ref_impl<_Yp&&, _Xp&>
4008 { };
4009
4010
4011 template<typename _Tp, typename _Up,
4012 template<typename> class _TQual, template<typename> class _UQual>
4013 struct basic_common_reference
4014 { };
4015
4016
4017 template<typename _Tp>
4018 struct __xref
4019 { template<typename _Up> using __type = __copy_cv<_Tp, _Up>; };
4020
4021 template<typename _Tp>
4022 struct __xref<_Tp&>
4023 { template<typename _Up> using __type = __copy_cv<_Tp, _Up>&; };
4024
4025 template<typename _Tp>
4026 struct __xref<_Tp&&>
4027 { template<typename _Up> using __type = __copy_cv<_Tp, _Up>&&; };
4028
4029 template<typename _Tp1, typename _Tp2>
4030 using __basic_common_ref
4031 = typename basic_common_reference<remove_cvref_t<_Tp1>,
4032 remove_cvref_t<_Tp2>,
4033 __xref<_Tp1>::template __type,
4034 __xref<_Tp2>::template __type>::type;
4035
4036
4037 template<typename... _Tp>
4038 struct common_reference;
4039
4040 template<typename... _Tp>
4042
4043
4044 template<>
4045 struct common_reference<>
4046 { };
4047
4048
4049 template<typename _Tp0>
4050 struct common_reference<_Tp0>
4051 { using type = _Tp0; };
4052
4053
4054 template<typename _Tp1, typename _Tp2, int _Bullet = 1, typename = void>
4055 struct __common_reference_impl
4056 : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1>
4057 { };
4058
4059
4060 template<typename _Tp1, typename _Tp2>
4061 struct common_reference<_Tp1, _Tp2>
4062 : __common_reference_impl<_Tp1, _Tp2>
4063 { };
4064
4065
4066 template<typename _Tp1, typename _Tp2>
4067 struct __common_reference_impl<_Tp1&, _Tp2&, 1,
4068 void_t<__common_ref<_Tp1&, _Tp2&>>>
4069 { using type = __common_ref<_Tp1&, _Tp2&>; };
4070
4071 template<typename _Tp1, typename _Tp2>
4072 struct __common_reference_impl<_Tp1&&, _Tp2&&, 1,
4073 void_t<__common_ref<_Tp1&&, _Tp2&&>>>
4074 { using type = __common_ref<_Tp1&&, _Tp2&&>; };
4075
4076 template<typename _Tp1, typename _Tp2>
4077 struct __common_reference_impl<_Tp1&, _Tp2&&, 1,
4078 void_t<__common_ref<_Tp1&, _Tp2&&>>>
4079 { using type = __common_ref<_Tp1&, _Tp2&&>; };
4080
4081 template<typename _Tp1, typename _Tp2>
4082 struct __common_reference_impl<_Tp1&&, _Tp2&, 1,
4083 void_t<__common_ref<_Tp1&&, _Tp2&>>>
4084 { using type = __common_ref<_Tp1&&, _Tp2&>; };
4085
4086
4087 template<typename _Tp1, typename _Tp2>
4088 struct __common_reference_impl<_Tp1, _Tp2, 2,
4089 void_t<__basic_common_ref<_Tp1, _Tp2>>>
4090 { using type = __basic_common_ref<_Tp1, _Tp2>; };
4091
4092
4093 template<typename _Tp1, typename _Tp2>
4094 struct __common_reference_impl<_Tp1, _Tp2, 3,
4095 void_t<__cond_res<_Tp1, _Tp2>>>
4096 { using type = __cond_res<_Tp1, _Tp2>; };
4097
4098
4099 template<typename _Tp1, typename _Tp2>
4100 struct __common_reference_impl<_Tp1, _Tp2, 4,
4102 { using type = common_type_t<_Tp1, _Tp2>; };
4103
4104
4105 template<typename _Tp1, typename _Tp2>
4106 struct __common_reference_impl<_Tp1, _Tp2, 5, void>
4107 { };
4108
4109
4110 template<typename _Tp1, typename _Tp2, typename... _Rest>
4111 struct common_reference<_Tp1, _Tp2, _Rest...>
4112 : __common_type_fold<common_reference<_Tp1, _Tp2>,
4113 __common_type_pack<_Rest...>>
4114 { };
4115
4116
4117 template<typename _Tp1, typename _Tp2, typename... _Rest>
4118 struct __common_type_fold<common_reference<_Tp1, _Tp2>,
4119 __common_type_pack<_Rest...>,
4121 : public common_reference<common_reference_t<_Tp1, _Tp2>, _Rest...>
4122 { };
4123
4124
4125#endif
4126
4127
4128
4129_GLIBCXX_END_NAMESPACE_VERSION
4130}
4131}
4132
4133#endif
4134
4135#endif
typename common_reference< _Tp... >::type common_reference_t
constexpr bool is_corresponding_member(_M1 _S1::*__m1, _M2 _S2::*__m2) noexcept
typename remove_reference< _Tp >::type remove_reference_t
Alias template for remove_reference.
typename result_of< _Tp >::type result_of_t
Alias template for result_of.
typename add_rvalue_reference< _Tp >::type add_rvalue_reference_t
Alias template for add_rvalue_reference.
typename make_unsigned< _Tp >::type make_unsigned_t
Alias template for make_unsigned.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
typename aligned_storage< _Len, _Align >::type aligned_storage_t
Alias template for aligned_storage.
typename remove_all_extents< _Tp >::type remove_all_extents_t
Alias template for remove_all_extents.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
typename conditional< _Cond, _Iftrue, _Iffalse >::type conditional_t
Alias template for conditional.
typename aligned_storage< _S_len, alignment_value >::type type
The storage.
typename remove_pointer< _Tp >::type remove_pointer_t
Alias template for remove_pointer.
typename add_lvalue_reference< _Tp >::type add_lvalue_reference_t
Alias template for add_lvalue_reference.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
typename add_pointer< _Tp >::type add_pointer_t
Alias template for add_pointer.
typename remove_extent< _Tp >::type remove_extent_t
Alias template for remove_extent.
typename underlying_type< _Tp >::type underlying_type_t
Alias template for underlying_type.
typename decay< _Tp >::type decay_t
Alias template for decay.
typename make_signed< _Tp >::type make_signed_t
Alias template for make_signed.
constexpr bool is_pointer_interconvertible_with_class(_Mem _Tp::*__mp) noexcept
True if __mp points to the first member of a standard-layout type.
typename enable_if< _Cond, _Tp >::type enable_if_t
Alias template for enable_if.
constexpr bool is_layout_compatible_v
constexpr bool is_pointer_interconvertible_base_of_v
auto declval() noexcept -> decltype(__declval< _Tp >(0))
void void_t
A metafunction that always yields void, used for detecting valid types.
ISO C++ entities toplevel namespace is std.
GNU extensions for public use.
Define a member typedef type only if a boolean constant is true.
is_member_function_pointer
is_nothrow_default_constructible
is_nothrow_copy_constructible
is_nothrow_move_constructible
is_nothrow_copy_assignable
is_nothrow_move_assignable
is_trivially_constructible
is_trivially_default_constructible
is_trivially_copy_constructible
is_trivially_move_constructible
is_trivially_copy_assignable
is_trivially_move_assignable
is_trivially_destructible
Provide aligned storage for types.
Define a member typedef type to one of two argument types.
The underlying type of an enum.
True if _Derived is standard-layout and has a base class of type _Base