258 template<
size_t _Idx,
typename _Head,
typename... _Tail>
259 struct _Tuple_impl<_Idx, _Head, _Tail...>
260 :
public _Tuple_impl<_Idx + 1, _Tail...>,
261 private _Head_base<_Idx, _Head>
263 template<size_t,
typename...>
friend struct _Tuple_impl;
265 typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
266 typedef _Head_base<_Idx, _Head> _Base;
268 static constexpr _Head&
269 _M_head(_Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
271 static constexpr const _Head&
272 _M_head(
const _Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
274 static constexpr _Inherited&
275 _M_tail(_Tuple_impl& __t)
noexcept {
return __t; }
277 static constexpr const _Inherited&
278 _M_tail(
const _Tuple_impl& __t)
noexcept {
return __t; }
280 constexpr _Tuple_impl()
281 : _Inherited(), _Base() { }
284 _Tuple_impl(
const _Head& __head,
const _Tail&... __tail)
285 : _Inherited(__tail...), _Base(__head)
288 template<
typename _UHead,
typename... _UTail,
289 typename = __enable_if_t<
sizeof...(_Tail) ==
sizeof...(_UTail)>>
291 _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
296 constexpr _Tuple_impl(
const _Tuple_impl&) =
default;
300 _Tuple_impl& operator=(
const _Tuple_impl&) =
delete;
302 _Tuple_impl(_Tuple_impl&&) =
default;
304 template<
typename... _UElements>
306 _Tuple_impl(
const _Tuple_impl<_Idx, _UElements...>& __in)
307 : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
308 _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in))
311 template<
typename _UHead,
typename... _UTails>
313 _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
315 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
317 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
320#if __cplusplus > 202002L
321 template<
typename... _UElements>
323 _Tuple_impl(_Tuple_impl<_Idx, _UElements...>& __in)
324 : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
325 _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in))
328 template<
typename _UHead,
typename... _UTails>
330 _Tuple_impl(
const _Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
332 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
334 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
338 template<
typename _Alloc>
340 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a)
341 : _Inherited(__tag, __a),
342 _Base(__tag, __use_alloc<_Head>(__a))
345 template<
typename _Alloc>
347 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
348 const _Head& __head,
const _Tail&... __tail)
349 : _Inherited(__tag, __a, __tail...),
350 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head)
353 template<
typename _Alloc,
typename _UHead,
typename... _UTail,
354 typename = __enable_if_t<
sizeof...(_Tail) ==
sizeof...(_UTail)>>
356 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
357 _UHead&& __head, _UTail&&... __tail)
359 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
363 template<
typename _Alloc>
365 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
366 const _Tuple_impl& __in)
367 : _Inherited(__tag, __a, _M_tail(__in)),
368 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in))
371 template<
typename _Alloc>
373 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
375 : _Inherited(__tag, __a,
std::move(_M_tail(__in))),
376 _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
380 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
382 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
383 const _Tuple_impl<_Idx, _UHead, _UTails...>& __in)
384 : _Inherited(__tag, __a,
385 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)),
386 _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a),
387 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))
390 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
392 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
393 _Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
395 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
396 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
398 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
401#if __cplusplus > 202002L
402 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
404 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
405 _Tuple_impl<_Idx, _UHead, _UTails...>& __in)
406 : _Inherited(__tag, __a,
407 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)),
408 _Base(__use_alloc<_Head, _Alloc, _UHead&>(__a),
409 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))
412 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
414 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
415 const _Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
417 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
418 _Base(__use_alloc<_Head, _Alloc, const _UHead>(__a),
420 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
424 template<
typename... _UElements>
427 _M_assign(
const _Tuple_impl<_Idx, _UElements...>& __in)
429 _M_head(*
this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in);
430 _M_tail(*this)._M_assign(
431 _Tuple_impl<_Idx, _UElements...>::_M_tail(__in));
434 template<
typename _UHead,
typename... _UTails>
437 _M_assign(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
440 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in));
441 _M_tail(*this)._M_assign(
442 std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)));
445#if __cplusplus > 202002L
446 template<
typename... _UElements>
448 _M_assign(
const _Tuple_impl<_Idx, _UElements...>& __in)
const
450 _M_head(*
this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in);
451 _M_tail(*this)._M_assign(
452 _Tuple_impl<_Idx, _UElements...>::_M_tail(__in));
455 template<
typename _UHead,
typename... _UTails>
457 _M_assign(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
const
460 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in));
461 _M_tail(*this)._M_assign(
462 std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)));
469 _M_swap(_Tuple_impl& __in)
472 swap(_M_head(*
this), _M_head(__in));
473 _Inherited::_M_swap(_M_tail(__in));
476#if __cplusplus > 202002L
478 _M_swap(
const _Tuple_impl& __in)
const
481 swap(_M_head(*
this), _M_head(__in));
482 _Inherited::_M_swap(_M_tail(__in));
745 template<
typename... _Elements>
751 using _TCC = _TupleConstraints<_Cond, _Elements...>;
754 template<
bool _Dummy>
755 using _ImplicitDefaultCtor = __enable_if_t<
756 _TCC<_Dummy>::__is_implicitly_default_constructible(),
760 template<
bool _Dummy>
761 using _ExplicitDefaultCtor = __enable_if_t<
762 _TCC<_Dummy>::__is_explicitly_default_constructible(),
766 template<
bool _Cond,
typename... _Args>
767 using _ImplicitCtor = __enable_if_t<
768 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
772 template<
bool _Cond,
typename... _Args>
773 using _ExplicitCtor = __enable_if_t<
774 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
777 template<
typename... _UElements>
779 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
781 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
784 template<
typename... _UElements>
785 static constexpr bool __nothrow_assignable()
788 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
792 template<
typename... _UElements>
793 static constexpr bool __nothrow_constructible()
796 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
800 template<
typename _Up>
801 static constexpr bool __valid_args()
803 return sizeof...(_Elements) == 1
804 && !
is_same<tuple, __remove_cvref_t<_Up>>::value;
808 template<
typename,
typename,
typename... _Tail>
809 static constexpr bool __valid_args()
810 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
821 template<
typename _Tuple,
typename = tuple,
822 typename = __remove_cvref_t<_Tuple>>
828 template<
typename _Tuple,
typename _Tp,
typename _Up>
829 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>>
830 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>
::type
834 template<
typename _Tuple,
typename _Tp>
835 struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>>
842 template<
typename _Tuple>
843 static constexpr bool __use_other_ctor()
844 {
return _UseOtherCtor<_Tuple>::value; }
846#if __cplusplus > 202002L
847 template<
typename... _Args>
848 static constexpr bool __constructible
849 = _TCC<true>::template __constructible<_Args...>::value;
851 template<
typename... _Args>
852 static constexpr bool __convertible
853 = _TCC<true>::template __convertible<_Args...>::value;
857 template<
typename _Dummy = void,
858 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
861 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
864 template<
typename _Dummy = void,
865 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
868 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
871 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
872 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
874 tuple(
const _Elements&... __elements)
875 noexcept(__nothrow_constructible<
const _Elements&...>())
876 : _Inherited(__elements...) { }
878 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
879 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
881 tuple(
const _Elements&... __elements)
882 noexcept(__nothrow_constructible<
const _Elements&...>())
883 : _Inherited(__elements...) { }
885 template<
typename... _UElements,
886 bool _Valid = __valid_args<_UElements...>(),
887 _ImplicitCtor<_Valid, _UElements...> =
true>
889 tuple(_UElements&&... __elements)
890 noexcept(__nothrow_constructible<_UElements...>())
893 template<
typename... _UElements,
894 bool _Valid = __valid_args<_UElements...>(),
895 _ExplicitCtor<_Valid, _UElements...> =
false>
897 tuple(_UElements&&... __elements)
898 noexcept(__nothrow_constructible<_UElements...>())
901 constexpr tuple(
const tuple&) =
default;
903 constexpr tuple(tuple&&) =
default;
905 template<
typename... _UElements,
906 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
907 && !__use_other_ctor<
const tuple<_UElements...>&>(),
908 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
910 tuple(
const tuple<_UElements...>& __in)
911 noexcept(__nothrow_constructible<
const _UElements&...>())
912 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
915 template<
typename... _UElements,
916 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
917 && !__use_other_ctor<
const tuple<_UElements...>&>(),
918 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
920 tuple(
const tuple<_UElements...>& __in)
921 noexcept(__nothrow_constructible<
const _UElements&...>())
922 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
925 template<
typename... _UElements,
926 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
927 && !__use_other_ctor<tuple<_UElements...>&&>(),
928 _ImplicitCtor<_Valid, _UElements...> =
true>
930 tuple(tuple<_UElements...>&& __in)
931 noexcept(__nothrow_constructible<_UElements...>())
932 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in)) { }
934 template<
typename... _UElements,
935 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
936 && !__use_other_ctor<tuple<_UElements...>&&>(),
937 _ExplicitCtor<_Valid, _UElements...> =
false>
939 tuple(tuple<_UElements...>&& __in)
940 noexcept(__nothrow_constructible<_UElements...>())
941 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&&>(__in)) { }
943#if __cplusplus > 202002L
944 template<
typename... _UElements>
945 requires (
sizeof...(_Elements) ==
sizeof...(_UElements))
946 && (!__use_other_ctor<tuple<_UElements...>&>())
947 && __constructible<_UElements&...>
948 explicit(!__convertible<_UElements&...>)
950 tuple(tuple<_UElements...>& __in)
951 noexcept(__nothrow_constructible<_UElements&...>())
952 : _Inherited(
static_cast<_Tuple_impl<0, _UElements...
>&>(__in))
955 template<
typename... _UElements>
956 requires (
sizeof...(_Elements) ==
sizeof...(_UElements))
957 && (!__use_other_ctor<
const tuple<_UElements...>&&>())
958 && __constructible<
const _UElements...>
959 explicit(!__convertible<
const _UElements...>)
961 tuple(
const tuple<_UElements...>&& __in)
962 noexcept(__nothrow_constructible<
const _UElements...>())
963 : _Inherited(
static_cast<const _Tuple_impl<0, _UElements...
>&&>(__in)) { }
968 template<
typename _Alloc,
969 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
971 tuple(allocator_arg_t __tag,
const _Alloc& __a)
972 : _Inherited(__tag, __a) { }
974 template<
typename _Alloc,
975 _ExplicitDefaultCtor<is_object<_Alloc>::value> =
false>
978 tuple(allocator_arg_t __tag,
const _Alloc& __a)
979 : _Inherited(__tag, __a) { }
981 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
982 _ImplicitCtor<_NotEmpty, const _Elements&...> =
true>
984 tuple(allocator_arg_t __tag,
const _Alloc& __a,
985 const _Elements&... __elements)
986 : _Inherited(__tag, __a, __elements...) { }
988 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
989 _ExplicitCtor<_NotEmpty, const _Elements&...> =
false>
992 tuple(allocator_arg_t __tag,
const _Alloc& __a,
993 const _Elements&... __elements)
994 : _Inherited(__tag, __a, __elements...) { }
996 template<
typename _Alloc,
typename... _UElements,
997 bool _Valid = __valid_args<_UElements...>(),
998 _ImplicitCtor<_Valid, _UElements...> =
true>
1000 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1001 _UElements&&... __elements)
1005 template<
typename _Alloc,
typename... _UElements,
1006 bool _Valid = __valid_args<_UElements...>(),
1007 _ExplicitCtor<_Valid, _UElements...> =
false>
1008 _GLIBCXX20_CONSTEXPR
1010 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1011 _UElements&&... __elements)
1015 template<
typename _Alloc>
1016 _GLIBCXX20_CONSTEXPR
1017 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1018 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
1020 template<
typename _Alloc>
1021 _GLIBCXX20_CONSTEXPR
1022 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
1023 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
1025 template<
typename _Alloc,
typename... _UElements,
1026 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1027 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1028 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1029 _GLIBCXX20_CONSTEXPR
1030 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1031 const tuple<_UElements...>& __in)
1032 : _Inherited(__tag, __a,
1033 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1036 template<
typename _Alloc,
typename... _UElements,
1037 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1038 && !__use_other_ctor<
const tuple<_UElements...>&>(),
1039 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1040 _GLIBCXX20_CONSTEXPR
1042 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1043 const tuple<_UElements...>& __in)
1044 : _Inherited(__tag, __a,
1045 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1048 template<
typename _Alloc,
typename... _UElements,
1049 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1050 && !__use_other_ctor<tuple<_UElements...>&&>(),
1051 _ImplicitCtor<_Valid, _UElements...> =
true>
1052 _GLIBCXX20_CONSTEXPR
1053 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1054 tuple<_UElements...>&& __in)
1055 : _Inherited(__tag, __a,
1056 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1059 template<
typename _Alloc,
typename... _UElements,
1060 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1061 && !__use_other_ctor<tuple<_UElements...>&&>(),
1062 _ExplicitCtor<_Valid, _UElements...> =
false>
1063 _GLIBCXX20_CONSTEXPR
1065 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1066 tuple<_UElements...>&& __in)
1067 : _Inherited(__tag, __a,
1068 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1071#if __cplusplus > 202002L
1072 template<
typename _Alloc,
typename... _UElements>
1073 requires (
sizeof...(_Elements) ==
sizeof...(_UElements))
1074 && (!__use_other_ctor<tuple<_UElements...>&>())
1075 && __constructible<_UElements&...>
1076 explicit(!__convertible<_UElements&...>)
1078 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1079 tuple<_UElements...>& __in)
1080 : _Inherited(__tag, __a,
1081 static_cast<_Tuple_impl<0, _UElements...
>&>(__in))
1084 template<
typename _Alloc,
typename... _UElements>
1085 requires (
sizeof...(_Elements) ==
sizeof...(_UElements))
1086 && (!__use_other_ctor<
const tuple<_UElements...>>())
1087 && __constructible<
const _UElements...>
1088 explicit(!__convertible<
const _UElements...>)
1090 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1091 const tuple<_UElements...>&& __in)
1092 : _Inherited(__tag, __a,
1093 static_cast<const _Tuple_impl<0, _UElements...
>&&>(__in))
1099 _GLIBCXX20_CONSTEXPR
1101 operator=(__conditional_t<__assignable<const _Elements&...>(),
1103 const __nonesuch&> __in)
1104 noexcept(__nothrow_assignable<
const _Elements&...>())
1106 this->_M_assign(__in);
1110 _GLIBCXX20_CONSTEXPR
1112 operator=(__conditional_t<__assignable<_Elements...>(),
1115 noexcept(__nothrow_assignable<_Elements...>())
1121 template<
typename... _UElements>
1122 _GLIBCXX20_CONSTEXPR
1123 __enable_if_t<__assignable<
const _UElements&...>(), tuple&>
1124 operator=(
const tuple<_UElements...>& __in)
1125 noexcept(__nothrow_assignable<
const _UElements&...>())
1127 this->_M_assign(__in);
1131 template<
typename... _UElements>
1132 _GLIBCXX20_CONSTEXPR
1133 __enable_if_t<__assignable<_UElements...>(), tuple&>
1134 operator=(tuple<_UElements...>&& __in)
1135 noexcept(__nothrow_assignable<_UElements...>())
1141#if __cplusplus > 202002L
1142 constexpr const tuple&
1143 operator=(
const tuple& __in)
const
1144 requires (is_copy_assignable_v<const _Elements> && ...)
1146 this->_M_assign(__in);
1150 constexpr const tuple&
1151 operator=(tuple&& __in)
const
1152 requires (is_assignable_v<const _Elements&, _Elements> && ...)
1158 template<
typename... _UElements>
1159 constexpr const tuple&
1160 operator=(
const tuple<_UElements...>& __in)
const
1161 requires (
sizeof...(_Elements) ==
sizeof...(_UElements))
1162 && (is_assignable_v<const _Elements&, const _UElements&> && ...)
1164 this->_M_assign(__in);
1168 template<
typename... _UElements>
1169 constexpr const tuple&
1170 operator=(tuple<_UElements...>&& __in)
const
1171 requires (
sizeof...(_Elements) ==
sizeof...(_UElements))
1172 && (is_assignable_v<const _Elements&, _UElements> && ...)
1180 _GLIBCXX20_CONSTEXPR
1183 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1184 { _Inherited::_M_swap(__in); }
1186#if __cplusplus > 202002L
1194 swap(
const tuple& __in)
const
1195 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1197 { _Inherited::_M_swap(__in); }
1238 template<
typename _T1,
typename _T2>
1239 class tuple<_T1, _T2> :
public _Tuple_impl<0, _T1, _T2>
1244 template<
bool _Dummy,
typename _U1,
typename _U2>
1245 using _ImplicitDefaultCtor = __enable_if_t<
1246 _TupleConstraints<_Dummy, _U1, _U2>::
1247 __is_implicitly_default_constructible(),
1251 template<
bool _Dummy,
typename _U1,
typename _U2>
1252 using _ExplicitDefaultCtor = __enable_if_t<
1253 _TupleConstraints<_Dummy, _U1, _U2>::
1254 __is_explicitly_default_constructible(),
1257 template<
bool _Dummy>
1258 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
1261 template<
bool _Cond,
typename _U1,
typename _U2>
1262 using _ImplicitCtor = __enable_if_t<
1263 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
1267 template<
bool _Cond,
typename _U1,
typename _U2>
1268 using _ExplicitCtor = __enable_if_t<
1269 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
1272 template<
typename _U1,
typename _U2>
1273 static constexpr bool __assignable()
1275 return __and_<is_assignable<_T1&, _U1>,
1279 template<
typename _U1,
typename _U2>
1280 static constexpr bool __nothrow_assignable()
1282 return __and_<is_nothrow_assignable<_T1&, _U1>,
1286 template<
typename _U1,
typename _U2>
1287 static constexpr bool __nothrow_constructible()
1289 return __and_<is_nothrow_constructible<_T1, _U1>,
1293 static constexpr bool __nothrow_default_constructible()
1295 return __and_<is_nothrow_default_constructible<_T1>,
1299 template<
typename _U1>
1300 static constexpr bool __is_alloc_arg()
1303#if __cplusplus > 202002L
1304 template<
typename _U1,
typename _U2>
1305 static constexpr bool __constructible
1306 = _TCC<true>::template __constructible<_U1, _U2>::value;
1308 template<
typename _U1,
typename _U2>
1309 static constexpr bool __convertible
1310 = _TCC<true>::template __convertible<_U1, _U2>::value;
1314 template<
bool _Dummy =
true,
1315 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
1318 noexcept(__nothrow_default_constructible())
1321 template<
bool _Dummy =
true,
1322 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
1325 noexcept(__nothrow_default_constructible())
1328 template<
bool _Dummy =
true,
1329 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
1331 tuple(
const _T1& __a1,
const _T2& __a2)
1332 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1333 : _Inherited(__a1, __a2) { }
1335 template<
bool _Dummy =
true,
1336 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
1338 tuple(
const _T1& __a1,
const _T2& __a2)
1339 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1340 : _Inherited(__a1, __a2) { }
1342 template<
typename _U1,
typename _U2,
1343 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
1345 tuple(_U1&& __a1, _U2&& __a2)
1346 noexcept(__nothrow_constructible<_U1, _U2>())
1349 template<
typename _U1,
typename _U2,
1350 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
1352 tuple(_U1&& __a1, _U2&& __a2)
1353 noexcept(__nothrow_constructible<_U1, _U2>())
1356 constexpr tuple(
const tuple&) =
default;
1358 constexpr tuple(tuple&&) =
default;
1360 template<
typename _U1,
typename _U2,
1361 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1363 tuple(
const tuple<_U1, _U2>& __in)
1364 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1367 template<
typename _U1,
typename _U2,
1368 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1370 tuple(
const tuple<_U1, _U2>& __in)
1371 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1374 template<
typename _U1,
typename _U2,
1375 _ImplicitCtor<true, _U1, _U2> =
true>
1377 tuple(tuple<_U1, _U2>&& __in)
1378 noexcept(__nothrow_constructible<_U1, _U2>())
1381 template<
typename _U1,
typename _U2,
1382 _ExplicitCtor<true, _U1, _U2> =
false>
1384 tuple(tuple<_U1, _U2>&& __in)
1385 noexcept(__nothrow_constructible<_U1, _U2>())
1388#if __cplusplus > 202002L
1389 template<
typename _U1,
typename _U2>
1390 requires __constructible<_U1&, _U2&>
1391 explicit(!__convertible<_U1&, _U2&>)
1393 tuple(tuple<_U1, _U2>& __in)
1394 noexcept(__nothrow_constructible<_U1&, _U2&>())
1397 template<
typename _U1,
typename _U2>
1398 requires __constructible<const _U1, const _U2>
1399 explicit(!__convertible<const _U1, const _U2>)
1401 tuple(
const tuple<_U1, _U2>&& __in)
1402 noexcept(__nothrow_constructible<const _U1, const _U2>())
1406 template<
typename _U1,
typename _U2,
1407 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1410 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1411 : _Inherited(__in.first, __in.second) { }
1413 template<
typename _U1,
typename _U2,
1414 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1417 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1418 : _Inherited(__in.first, __in.second) { }
1420 template<
typename _U1,
typename _U2,
1421 _ImplicitCtor<true, _U1, _U2> =
true>
1424 noexcept(__nothrow_constructible<_U1, _U2>())
1428 template<
typename _U1,
typename _U2,
1429 _ExplicitCtor<true, _U1, _U2> =
false>
1432 noexcept(__nothrow_constructible<_U1, _U2>())
1436#if __cplusplus > 202002L
1437 template<
typename _U1,
typename _U2>
1438 requires __constructible<_U1&, _U2&>
1439 explicit(!__convertible<_U1&, _U2&>)
1442 noexcept(__nothrow_constructible<_U1&, _U2&>())
1443 : _Inherited(__in.first, __in.second) { }
1445 template<
typename _U1,
typename _U2>
1446 requires __constructible<const _U1, const _U2>
1447 explicit(!__convertible<const _U1, const _U2>)
1450 noexcept(__nothrow_constructible<const _U1, const _U2>())
1457 template<
typename _Alloc,
1458 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
1459 _GLIBCXX20_CONSTEXPR
1460 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1461 : _Inherited(__tag, __a) { }
1463 template<
typename _Alloc,
1464 _ExplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
false>
1465 _GLIBCXX20_CONSTEXPR
1467 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1468 : _Inherited(__tag, __a) { }
1470 template<
typename _Alloc,
bool _Dummy =
true,
1471 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
1472 _GLIBCXX20_CONSTEXPR
1473 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1474 const _T1& __a1,
const _T2& __a2)
1475 : _Inherited(__tag, __a, __a1, __a2) { }
1477 template<
typename _Alloc,
bool _Dummy =
true,
1478 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
1480 _GLIBCXX20_CONSTEXPR
1481 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1482 const _T1& __a1,
const _T2& __a2)
1483 : _Inherited(__tag, __a, __a1, __a2) { }
1485 template<
typename _Alloc,
typename _U1,
typename _U2,
1486 _ImplicitCtor<true, _U1, _U2> =
true>
1487 _GLIBCXX20_CONSTEXPR
1488 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
1492 template<
typename _Alloc,
typename _U1,
typename _U2,
1493 _ExplicitCtor<true, _U1, _U2> =
false>
1495 _GLIBCXX20_CONSTEXPR
1496 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1497 _U1&& __a1, _U2&& __a2)
1501 template<
typename _Alloc>
1502 _GLIBCXX20_CONSTEXPR
1503 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1504 : _Inherited(__tag, __a,
static_cast<const _Inherited&
>(__in)) { }
1506 template<
typename _Alloc>
1507 _GLIBCXX20_CONSTEXPR
1508 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple&& __in)
1509 : _Inherited(__tag, __a,
static_cast<_Inherited&&
>(__in)) { }
1511 template<
typename _Alloc,
typename _U1,
typename _U2,
1512 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1513 _GLIBCXX20_CONSTEXPR
1514 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1515 const tuple<_U1, _U2>& __in)
1516 : _Inherited(__tag, __a,
1520 template<
typename _Alloc,
typename _U1,
typename _U2,
1521 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1523 _GLIBCXX20_CONSTEXPR
1524 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1525 const tuple<_U1, _U2>& __in)
1526 : _Inherited(__tag, __a,
1530 template<
typename _Alloc,
typename _U1,
typename _U2,
1531 _ImplicitCtor<true, _U1, _U2> =
true>
1532 _GLIBCXX20_CONSTEXPR
1533 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
1537 template<
typename _Alloc,
typename _U1,
typename _U2,
1538 _ExplicitCtor<true, _U1, _U2> =
false>
1540 _GLIBCXX20_CONSTEXPR
1541 tuple(allocator_arg_t __tag,
const _Alloc& __a, tuple<_U1, _U2>&& __in)
1545#if __cplusplus > 202002L
1546 template<
typename _Alloc,
typename _U1,
typename _U2>
1547 requires __constructible<_U1&, _U2&>
1548 explicit(!__convertible<_U1&, _U2&>)
1550 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1551 tuple<_U1, _U2>& __in)
1552 : _Inherited(__tag, __a,
1556 template<
typename _Alloc,
typename _U1,
typename _U2>
1557 requires __constructible<const _U1, const _U2>
1558 explicit(!__convertible<const _U1, const _U2>)
1560 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1561 const tuple<_U1, _U2>&& __in)
1562 : _Inherited(__tag, __a,
1567 template<
typename _Alloc,
typename _U1,
typename _U2,
1568 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1569 _GLIBCXX20_CONSTEXPR
1570 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1572 : _Inherited(__tag, __a, __in.first, __in.second) { }
1574 template<
typename _Alloc,
typename _U1,
typename _U2,
1575 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1577 _GLIBCXX20_CONSTEXPR
1578 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1580 : _Inherited(__tag, __a, __in.first, __in.second) { }
1582 template<
typename _Alloc,
typename _U1,
typename _U2,
1583 _ImplicitCtor<true, _U1, _U2> =
true>
1584 _GLIBCXX20_CONSTEXPR
1585 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
1589 template<
typename _Alloc,
typename _U1,
typename _U2,
1590 _ExplicitCtor<true, _U1, _U2> =
false>
1592 _GLIBCXX20_CONSTEXPR
1593 tuple(allocator_arg_t __tag,
const _Alloc& __a,
pair<_U1, _U2>&& __in)
1597#if __cplusplus > 202002L
1598 template<
typename _Alloc,
typename _U1,
typename _U2>
1599 requires __constructible<_U1&, _U2&>
1600 explicit(!__convertible<_U1&, _U2&>)
1602 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1604 : _Inherited(__tag, __a, __in.first, __in.second) { }
1606 template<
typename _Alloc,
typename _U1,
typename _U2>
1607 requires __constructible<const _U1, const _U2>
1608 explicit(!__convertible<const _U1, const _U2>)
1610 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const pair<_U1, _U2>&& __in)
1617 _GLIBCXX20_CONSTEXPR
1619 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
1621 const __nonesuch&> __in)
1622 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
1624 this->_M_assign(__in);
1628 _GLIBCXX20_CONSTEXPR
1630 operator=(__conditional_t<__assignable<_T1, _T2>(),
1633 noexcept(__nothrow_assignable<_T1, _T2>())
1639 template<
typename _U1,
typename _U2>
1640 _GLIBCXX20_CONSTEXPR
1641 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
1642 operator=(
const tuple<_U1, _U2>& __in)
1643 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1645 this->_M_assign(__in);
1649 template<
typename _U1,
typename _U2>
1650 _GLIBCXX20_CONSTEXPR
1651 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
1652 operator=(tuple<_U1, _U2>&& __in)
1653 noexcept(__nothrow_assignable<_U1, _U2>())
1659#if __cplusplus > 202002L
1660 constexpr const tuple&
1661 operator=(
const tuple& __in)
const
1662 requires is_copy_assignable_v<const _T1> && is_copy_assignable_v<const _T2>
1664 this->_M_assign(__in);
1668 constexpr const tuple&
1669 operator=(tuple&& __in)
const
1670 requires is_assignable_v<const _T1&, _T1> && is_assignable_v<const _T2, _T2>
1676 template<
typename _U1,
typename _U2>
1677 constexpr const tuple&
1678 operator=(
const tuple<_U1, _U2>& __in)
const
1679 requires is_assignable_v<const _T1&, const _U1&>
1680 && is_assignable_v<const _T2&, const _U2&>
1682 this->_M_assign(__in);
1686 template<
typename _U1,
typename _U2>
1687 constexpr const tuple&
1688 operator=(tuple<_U1, _U2>&& __in)
const
1689 requires is_assignable_v<const _T1&, _U1>
1690 && is_assignable_v<const _T2&, _U2>
1697 template<
typename _U1,
typename _U2>
1698 _GLIBCXX20_CONSTEXPR
1699 __enable_if_t<__assignable<const _U1&, const _U2&>(), tuple&>
1701 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1703 this->_M_head(*
this) = __in.first;
1704 this->_M_tail(*this)._M_head(*
this) = __in.second;
1708 template<
typename _U1,
typename _U2>
1709 _GLIBCXX20_CONSTEXPR
1710 __enable_if_t<__assignable<_U1, _U2>(), tuple&>
1712 noexcept(__nothrow_assignable<_U1, _U2>())
1719#if __cplusplus > 202002L
1720 template<
typename _U1,
typename _U2>
1721 constexpr const tuple&
1723 requires is_assignable_v<const _T1&, const _U1&>
1724 && is_assignable_v<const _T2&, const _U2&>
1726 this->_M_head(*
this) = __in.first;
1727 this->_M_tail(*this)._M_head(*
this) = __in.second;
1731 template<
typename _U1,
typename _U2>
1732 constexpr const tuple&
1734 requires is_assignable_v<const _T1&, _U1>
1735 && is_assignable_v<const _T2&, _U2>
1743 _GLIBCXX20_CONSTEXPR
1746 noexcept(__and_<__is_nothrow_swappable<_T1>,
1747 __is_nothrow_swappable<_T2>>::value)
1748 { _Inherited::_M_swap(__in); }
1750#if __cplusplus > 202002L
1752 swap(
const tuple& __in)
const
1753 noexcept(__and_v<__is_nothrow_swappable<const _T1>,
1754 __is_nothrow_swappable<const _T2>>)
1756 { _Inherited::_M_swap(__in); }