203 _Head_base(allocator_arg_t, __uses_alloc0)
206 template<
typename _Alloc>
208 _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a)
209 : _M_head_impl(allocator_arg, *__a._M_a) { }
211 template<
typename _Alloc>
213 _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a)
214 : _M_head_impl(*__a._M_a) { }
216 template<
typename _UHead>
218 _Head_base(__uses_alloc0, _UHead&& __uhead)
219 : _M_head_impl(
std::
forward<_UHead>(__uhead)) { }
221 template<
typename _Alloc,
typename _UHead>
223 _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
224 : _M_head_impl(allocator_arg, *__a._M_a,
std::
forward<_UHead>(__uhead))
227 template<
typename _Alloc,
typename _UHead>
229 _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
230 : _M_head_impl(
std::
forward<_UHead>(__uhead), *__a._M_a) { }
232 static constexpr _Head&
233 _M_head(_Head_base& __b)
noexcept {
return __b._M_head_impl; }
235 static constexpr const _Head&
236 _M_head(
const _Head_base& __b)
noexcept {
return __b._M_head_impl; }
249 template<
size_t _Idx,
typename... _Elements>
257 template<
size_t _Idx,
typename _Head,
typename... _Tail>
260 private _Head_base<_Idx, _Head>
262 template<size_t,
typename...>
friend struct _Tuple_impl;
265 typedef _Head_base<_Idx, _Head> _Base;
267 static constexpr _Head&
268 _M_head(
_Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
270 static constexpr const _Head&
271 _M_head(
const _Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
277 _M_tail(
const _Tuple_impl& __t)
noexcept {
return __t; }
283 _Tuple_impl(
const _Head& __head,
const _Tail&... __tail)
287 template<
typename _UHead,
typename... _UTail,
288 typename = __enable_if_t<
sizeof...(_Tail) ==
sizeof...(_UTail)>>
291 :
_Inherited(std::forward<_UTail>(__tail)...),
292 _Base(std::forward<_UHead>(__head))
303 template<
typename... _UElements>
310 template<
typename _UHead,
typename... _UTails>
315 _Base(std::forward<_UHead>
319 template<
typename _Alloc>
321 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a)
323 _Base(__tag, __use_alloc<_Head>(__a))
326 template<
typename _Alloc>
328 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
329 const _Head& __head,
const _Tail&... __tail)
331 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head)
334 template<
typename _Alloc,
typename _UHead,
typename... _UTail,
335 typename = __enable_if_t<
sizeof...(_Tail) ==
sizeof...(_UTail)>>
337 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
338 _UHead&& __head, _UTail&&... __tail)
339 :
_Inherited(__tag, __a, std::forward<_UTail>(__tail)...),
340 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
341 std::forward<_UHead>(__head))
344 template<
typename _Alloc>
346 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
349 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in))
352 template<
typename _Alloc>
354 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
357 _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
358 std::forward<_Head>(_M_head(__in)))
361 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
363 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
367 _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a),
371 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
373 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
377 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
382 template<
typename... _UElements>
388 _M_tail(*this)._M_assign(
392 template<
typename _UHead,
typename... _UTails>
397 _M_head(*
this) = std::forward<_UHead>
399 _M_tail(*this)._M_assign(
409 swap(_M_head(*
this), _M_head(__in));
410 _Inherited::_M_swap(_M_tail(__in));
415 template<
size_t _Idx,
typename _Head>
417 :
private _Head_base<_Idx, _Head>
419 template<size_t,
typename...>
friend struct _Tuple_impl;
421 typedef _Head_base<_Idx, _Head> _Base;
423 static constexpr _Head&
424 _M_head(
_Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
426 static constexpr const _Head&
427 _M_head(
const _Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
434 _Tuple_impl(
const _Head& __head)
438 template<
typename _UHead>
440 _Tuple_impl(_UHead&& __head)
444 constexpr _Tuple_impl(
const _Tuple_impl&) =
default;
448 _Tuple_impl& operator=(
const _Tuple_impl&) =
delete;
450#if _GLIBCXX_INLINE_VERSION
451 _Tuple_impl(_Tuple_impl&&) =
default;
454 _Tuple_impl(_Tuple_impl&& __in)
455 noexcept(is_nothrow_move_constructible<_Head>::value)
456 : _Base(static_cast<_Base&&>(__in))
460 template<
typename _UHead>
462 _Tuple_impl(
const _Tuple_impl<_Idx, _UHead>& __in)
463 : _Base(_Tuple_impl<_Idx, _UHead>::_M_head(__in))
466 template<
typename _UHead>
468 _Tuple_impl(_Tuple_impl<_Idx, _UHead>&& __in)
469 : _Base(
std::
forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
472 template<
typename _Alloc>
474 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a)
475 : _Base(__tag, __use_alloc<_Head>(__a))
478 template<
typename _Alloc>
480 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
482 : _Base(__use_alloc<_Head, _Alloc, const _Head&>(__a), __head)
485 template<
typename _Alloc,
typename _UHead>
487 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
489 : _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
493 template<
typename _Alloc>
495 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
496 const _Tuple_impl& __in)
497 : _Base(__use_alloc<_Head, _Alloc, const _Head&>(__a), _M_head(__in))
500 template<
typename _Alloc>
502 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
504 : _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
508 template<
typename _Alloc,
typename _UHead>
510 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
511 const _Tuple_impl<_Idx, _UHead>& __in)
512 : _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a),
513 _Tuple_impl<_Idx, _UHead>::_M_head(__in))
516 template<
typename _Alloc,
typename _UHead>
518 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
519 _Tuple_impl<_Idx, _UHead>&& __in)
520 : _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
521 std::
forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
524 template<
typename _UHead>
527 _M_assign(
const _Tuple_impl<_Idx, _UHead>& __in)
529 _M_head(*
this) = _Tuple_impl<_Idx, _UHead>::_M_head(__in);
532 template<
typename _UHead>
535 _M_assign(_Tuple_impl<_Idx, _UHead>&& __in)
538 = std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in));
544 _M_swap(_Tuple_impl& __in)
547 swap(_M_head(*
this), _M_head(__in));
553 template<bool,
typename... _Types>
554 struct _TupleConstraints
559 template<
typename... _UTypes>
560 static constexpr bool __is_implicitly_constructible()
562 return __and_<is_constructible<_Types, _UTypes>...,
563 is_convertible<_UTypes, _Types>...
570 template<
typename... _UTypes>
571 static constexpr bool __is_explicitly_constructible()
573 return __and_<is_constructible<_Types, _UTypes>...,
574 __not_<__and_<is_convertible<_UTypes, _Types>...>>
578 static constexpr bool __is_implicitly_default_constructible()
580 return __and_<std::__is_implicitly_default_constructible<_Types>...
584 static constexpr bool __is_explicitly_default_constructible()
586 return __and_<is_default_constructible<_Types>...,
588 std::__is_implicitly_default_constructible<_Types>...>
595 template<
typename... _Types>
596 struct _TupleConstraints<false, _Types...>
598 template<
typename... _UTypes>
599 static constexpr bool __is_implicitly_constructible()
602 template<
typename... _UTypes>
603 static constexpr bool __is_explicitly_constructible()
608 template<
typename... _Elements>
614 using _TCC = _TupleConstraints<_Cond, _Elements...>;
617 template<
bool _Dummy>
618 using _ImplicitDefaultCtor = __enable_if_t<
619 _TCC<_Dummy>::__is_implicitly_default_constructible(),
623 template<
bool _Dummy>
624 using _ExplicitDefaultCtor = __enable_if_t<
625 _TCC<_Dummy>::__is_explicitly_default_constructible(),
629 template<
bool _Cond,
typename... _Args>
630 using _ImplicitCtor = __enable_if_t<
631 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
635 template<
bool _Cond,
typename... _Args>
636 using _ExplicitCtor = __enable_if_t<
637 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
640 template<
typename... _UElements>
642 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
644 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
647 template<
typename... _UElements>
648 static constexpr bool __nothrow_assignable()
651 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
655 template<
typename... _UElements>
656 static constexpr bool __nothrow_constructible()
659 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
663 template<
typename _Up>
664 static constexpr bool __valid_args()
666 return sizeof...(_Elements) == 1
671 template<
typename,
typename,
typename... _Tail>
672 static constexpr bool __valid_args()
673 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
684 template<
typename _Tuple,
typename =
tuple,
685 typename = __remove_cvref_t<_Tuple>>
691 template<
typename _Tuple,
typename _Tp,
typename _Up>
692 struct _UseOtherCtor<_Tuple,
tuple<_Tp>,
tuple<_Up>>
693 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>
697 template<
typename _Tuple,
typename _Tp>
698 struct _UseOtherCtor<_Tuple,
tuple<_Tp>,
tuple<_Tp>>
705 template<
typename _Tuple>
706 static constexpr bool __use_other_ctor()
707 {
return _UseOtherCtor<_Tuple>::value; }
710 template<
typename _Dummy = void,
711 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
714 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
717 template<
typename _Dummy = void,
718 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
721 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
724 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
725 _ImplicitCtor<_NotEmpty,
const _Elements&...> =
true>
727 tuple(
const _Elements&... __elements)
728 noexcept(__nothrow_constructible<
const _Elements&...>())
731 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
732 _ExplicitCtor<_NotEmpty,
const _Elements&...> =
false>
734 tuple(
const _Elements&... __elements)
735 noexcept(__nothrow_constructible<
const _Elements&...>())
738 template<
typename... _UElements,
739 bool _Valid = __valid_args<_UElements...>(),
740 _ImplicitCtor<_Valid, _UElements...> =
true>
742 tuple(_UElements&&... __elements)
743 noexcept(__nothrow_constructible<_UElements...>())
744 :
_Inherited(std::forward<_UElements>(__elements)...) { }
746 template<
typename... _UElements,
747 bool _Valid = __valid_args<_UElements...>(),
748 _ExplicitCtor<_Valid, _UElements...> =
false>
750 tuple(_UElements&&... __elements)
751 noexcept(__nothrow_constructible<_UElements...>())
752 :
_Inherited(std::forward<_UElements>(__elements)...) { }
758 template<
typename... _UElements,
759 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
761 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
764 noexcept(__nothrow_constructible<
const _UElements&...>())
768 template<
typename... _UElements,
769 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
771 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
774 noexcept(__nothrow_constructible<
const _UElements&...>())
778 template<
typename... _UElements,
779 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
781 _ImplicitCtor<_Valid, _UElements...> =
true>
784 noexcept(__nothrow_constructible<_UElements...>())
787 template<
typename... _UElements,
788 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
790 _ExplicitCtor<_Valid, _UElements...> =
false>
793 noexcept(__nothrow_constructible<_UElements...>())
798 template<
typename _Alloc,
799 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
801 tuple(allocator_arg_t __tag,
const _Alloc& __a)
804 template<
typename _Alloc,
805 _ExplicitDefaultCtor<is_object<_Alloc>::value> =
false>
808 tuple(allocator_arg_t __tag,
const _Alloc& __a)
811 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
812 _ImplicitCtor<_NotEmpty,
const _Elements&...> =
true>
814 tuple(allocator_arg_t __tag,
const _Alloc& __a,
815 const _Elements&... __elements)
818 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
819 _ExplicitCtor<_NotEmpty,
const _Elements&...> =
false>
822 tuple(allocator_arg_t __tag,
const _Alloc& __a,
823 const _Elements&... __elements)
826 template<
typename _Alloc,
typename... _UElements,
827 bool _Valid = __valid_args<_UElements...>(),
828 _ImplicitCtor<_Valid, _UElements...> =
true>
830 tuple(allocator_arg_t __tag,
const _Alloc& __a,
831 _UElements&&... __elements)
832 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
835 template<
typename _Alloc,
typename... _UElements,
836 bool _Valid = __valid_args<_UElements...>(),
837 _ExplicitCtor<_Valid, _UElements...> =
false>
840 tuple(allocator_arg_t __tag,
const _Alloc& __a,
841 _UElements&&... __elements)
842 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
845 template<
typename _Alloc>
847 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
850 template<
typename _Alloc>
852 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
855 template<
typename _Alloc,
typename... _UElements,
856 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
858 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
860 tuple(allocator_arg_t __tag,
const _Alloc& __a,
863 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
866 template<
typename _Alloc,
typename... _UElements,
867 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
869 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
872 tuple(allocator_arg_t __tag,
const _Alloc& __a,
875 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
878 template<
typename _Alloc,
typename... _UElements,
879 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
881 _ImplicitCtor<_Valid, _UElements...> =
true>
883 tuple(allocator_arg_t __tag,
const _Alloc& __a,
886 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
889 template<
typename _Alloc,
typename... _UElements,
890 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
892 _ExplicitCtor<_Valid, _UElements...> =
false>
895 tuple(allocator_arg_t __tag,
const _Alloc& __a,
898 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
905 operator=(__conditional_t<__assignable<const _Elements&...>(),
907 const __nonesuch&> __in)
908 noexcept(__nothrow_assignable<
const _Elements&...>())
910 this->_M_assign(__in);
916 operator=(__conditional_t<__assignable<_Elements...>(),
919 noexcept(__nothrow_assignable<_Elements...>())
925 template<
typename... _UElements>
927 __enable_if_t<__assignable<
const _UElements&...>(),
tuple&>
929 noexcept(__nothrow_assignable<
const _UElements&...>())
931 this->_M_assign(__in);
935 template<
typename... _UElements>
937 __enable_if_t<__assignable<_UElements...>(),
tuple&>
939 noexcept(__nothrow_assignable<_UElements...>())
949 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
950 { _Inherited::_M_swap(__in); }
953#if __cpp_deduction_guides >= 201606
954 template<
typename... _UTypes>
956 template<
typename _T1,
typename _T2>
958 template<
typename _Alloc,
typename... _UTypes>
959 tuple(allocator_arg_t, _Alloc, _UTypes...) ->
tuple<_UTypes...>;
960 template<
typename _Alloc,
typename _T1,
typename _T2>
962 template<
typename _Alloc,
typename... _UTypes>
972 void swap(
tuple&)
noexcept { }
977 template<
typename _Alloc>
979 tuple(allocator_arg_t,
const _Alloc&)
noexcept { }
980 template<
typename _Alloc>
982 tuple(allocator_arg_t,
const _Alloc&,
const tuple&)
noexcept { }
987 template<
typename _T1,
typename _T2>
993 template<
bool _Dummy,
typename _U1,
typename _U2>
994 using _ImplicitDefaultCtor = __enable_if_t<
995 _TupleConstraints<_Dummy, _U1, _U2>::
996 __is_implicitly_default_constructible(),
1000 template<
bool _Dummy,
typename _U1,
typename _U2>
1001 using _ExplicitDefaultCtor = __enable_if_t<
1002 _TupleConstraints<_Dummy, _U1, _U2>::
1003 __is_explicitly_default_constructible(),
1006 template<
bool _Dummy>
1007 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
1010 template<
bool _Cond,
typename _U1,
typename _U2>
1011 using _ImplicitCtor = __enable_if_t<
1012 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
1016 template<
bool _Cond,
typename _U1,
typename _U2>
1017 using _ExplicitCtor = __enable_if_t<
1018 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
1021 template<
typename _U1,
typename _U2>
1022 static constexpr bool __assignable()
1024 return __and_<is_assignable<_T1&, _U1>,
1028 template<
typename _U1,
typename _U2>
1029 static constexpr bool __nothrow_assignable()
1031 return __and_<is_nothrow_assignable<_T1&, _U1>,
1035 template<
typename _U1,
typename _U2>
1036 static constexpr bool __nothrow_constructible()
1038 return __and_<is_nothrow_constructible<_T1, _U1>,
1042 static constexpr bool __nothrow_default_constructible()
1044 return __and_<is_nothrow_default_constructible<_T1>,
1048 template<
typename _U1>
1049 static constexpr bool __is_alloc_arg()
1053 template<
bool _Dummy =
true,
1054 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
1057 noexcept(__nothrow_default_constructible())
1060 template<
bool _Dummy =
true,
1061 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
1064 noexcept(__nothrow_default_constructible())
1067 template<
bool _Dummy =
true,
1068 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
1070 tuple(
const _T1& __a1,
const _T2& __a2)
1071 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1074 template<
bool _Dummy =
true,
1075 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
1077 tuple(
const _T1& __a1,
const _T2& __a2)
1078 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1081 template<
typename _U1,
typename _U2,
1082 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
1084 tuple(_U1&& __a1, _U2&& __a2)
1085 noexcept(__nothrow_constructible<_U1, _U2>())
1086 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
1088 template<
typename _U1,
typename _U2,
1089 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
1091 tuple(_U1&& __a1, _U2&& __a2)
1092 noexcept(__nothrow_constructible<_U1, _U2>())
1093 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
1099 template<
typename _U1,
typename _U2,
1100 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1103 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1106 template<
typename _U1,
typename _U2,
1107 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1110 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1113 template<
typename _U1,
typename _U2,
1114 _ImplicitCtor<true, _U1, _U2> =
true>
1117 noexcept(__nothrow_constructible<_U1, _U2>())
1120 template<
typename _U1,
typename _U2,
1121 _ExplicitCtor<true, _U1, _U2> =
false>
1124 noexcept(__nothrow_constructible<_U1, _U2>())
1127 template<
typename _U1,
typename _U2,
1128 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1131 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1134 template<
typename _U1,
typename _U2,
1135 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1138 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1141 template<
typename _U1,
typename _U2,
1142 _ImplicitCtor<true, _U1, _U2> =
true>
1145 noexcept(__nothrow_constructible<_U1, _U2>())
1147 std::forward<_U2>(__in.second)) { }
1149 template<
typename _U1,
typename _U2,
1150 _ExplicitCtor<true, _U1, _U2> =
false>
1153 noexcept(__nothrow_constructible<_U1, _U2>())
1155 std::forward<_U2>(__in.second)) { }
1159 template<
typename _Alloc,
1160 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
1161 _GLIBCXX20_CONSTEXPR
1162 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1165 template<
typename _Alloc,
1166 _ExplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
false>
1167 _GLIBCXX20_CONSTEXPR
1169 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1172 template<
typename _Alloc,
bool _Dummy =
true,
1173 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
1174 _GLIBCXX20_CONSTEXPR
1175 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1176 const _T1& __a1,
const _T2& __a2)
1179 template<
typename _Alloc,
bool _Dummy =
true,
1180 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
1182 _GLIBCXX20_CONSTEXPR
1183 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1184 const _T1& __a1,
const _T2& __a2)
1187 template<
typename _Alloc,
typename _U1,
typename _U2,
1188 _ImplicitCtor<true, _U1, _U2> =
true>
1189 _GLIBCXX20_CONSTEXPR
1190 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
1191 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
1192 std::forward<_U2>(__a2)) { }
1194 template<
typename _Alloc,
typename _U1,
typename _U2,
1195 _ExplicitCtor<true, _U1, _U2> =
false>
1197 _GLIBCXX20_CONSTEXPR
1198 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1199 _U1&& __a1, _U2&& __a2)
1200 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
1201 std::forward<_U2>(__a2)) { }
1203 template<
typename _Alloc>
1204 _GLIBCXX20_CONSTEXPR
1205 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1208 template<
typename _Alloc>
1209 _GLIBCXX20_CONSTEXPR
1210 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
1213 template<
typename _Alloc,
typename _U1,
typename _U2,
1214 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1215 _GLIBCXX20_CONSTEXPR
1216 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1222 template<
typename _Alloc,
typename _U1,
typename _U2,
1223 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1225 _GLIBCXX20_CONSTEXPR
1226 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1232 template<
typename _Alloc,
typename _U1,
typename _U2,
1233 _ImplicitCtor<true, _U1, _U2> =
true>
1234 _GLIBCXX20_CONSTEXPR
1239 template<
typename _Alloc,
typename _U1,
typename _U2,
1240 _ExplicitCtor<true, _U1, _U2> =
false>
1242 _GLIBCXX20_CONSTEXPR
1247 template<
typename _Alloc,
typename _U1,
typename _U2,
1248 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1249 _GLIBCXX20_CONSTEXPR
1250 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1252 :
_Inherited(__tag, __a, __in.first, __in.second) { }
1254 template<
typename _Alloc,
typename _U1,
typename _U2,
1255 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1257 _GLIBCXX20_CONSTEXPR
1258 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1260 :
_Inherited(__tag, __a, __in.first, __in.second) { }
1262 template<
typename _Alloc,
typename _U1,
typename _U2,
1263 _ImplicitCtor<true, _U1, _U2> =
true>
1264 _GLIBCXX20_CONSTEXPR
1266 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
1267 std::forward<_U2>(__in.second)) { }
1269 template<
typename _Alloc,
typename _U1,
typename _U2,
1270 _ExplicitCtor<true, _U1, _U2> =
false>
1272 _GLIBCXX20_CONSTEXPR
1274 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
1275 std::forward<_U2>(__in.second)) { }
1279 _GLIBCXX20_CONSTEXPR
1281 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
1283 const __nonesuch&> __in)
1284 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
1286 this->_M_assign(__in);
1290 _GLIBCXX20_CONSTEXPR
1292 operator=(__conditional_t<__assignable<_T1, _T2>(),
1295 noexcept(__nothrow_assignable<_T1, _T2>())
1301 template<
typename _U1,
typename _U2>
1302 _GLIBCXX20_CONSTEXPR
1303 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
1305 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1307 this->_M_assign(__in);
1311 template<
typename _U1,
typename _U2>
1312 _GLIBCXX20_CONSTEXPR
1313 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
1315 noexcept(__nothrow_assignable<_U1, _U2>())
1321 template<
typename _U1,
typename _U2>
1322 _GLIBCXX20_CONSTEXPR
1323 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
1325 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1327 this->_M_head(*
this) = __in.first;
1328 this->_M_tail(*this)._M_head(*
this) = __in.second;
1332 template<
typename _U1,
typename _U2>
1333 _GLIBCXX20_CONSTEXPR
1334 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
1336 noexcept(__nothrow_assignable<_U1, _U2>())
1338 this->_M_head(*
this) = std::forward<_U1>(__in.first);
1339 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__in.second);
1343 _GLIBCXX20_CONSTEXPR
1346 noexcept(__and_<__is_nothrow_swappable<_T1>,
1347 __is_nothrow_swappable<_T2>>::value)
1348 { _Inherited::_M_swap(__in); }
1353 template<
typename... _Elements>
1357#if __cplusplus >= 201703L
1358 template<
typename... _Types>
1359 inline constexpr size_t tuple_size_v<
tuple<_Types...>>
1360 =
sizeof...(_Types);
1362 template<
typename... _Types>
1363 inline constexpr size_t tuple_size_v<
const tuple<_Types...>>
1364 =
sizeof...(_Types);
1368 template<
size_t __i,
typename... _Types>
1371 static_assert(__i <
sizeof...(_Types),
"tuple index must be in range");
1373 using type =
typename _Nth_type<__i, _Types...>::type;
1376 template<
size_t __i,
typename _Head,
typename... _Tail>
1381 template<
size_t __i,
typename _Head,
typename... _Tail>
1382 constexpr const _Head&
1383 __get_helper(
const _Tuple_impl<__i, _Head, _Tail...>& __t)
noexcept
1384 {
return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
1387 template<
size_t __i,
typename... _Types>
1388 __enable_if_t<(__i >=
sizeof...(_Types))>
1389 __get_helper(
const tuple<_Types...>&) =
delete;
1392 template<
size_t __i,
typename... _Elements>
1393 constexpr __tuple_element_t<__i, tuple<_Elements...>>&
1395 {
return std::__get_helper<__i>(__t); }
1398 template<
size_t __i,
typename... _Elements>
1399 constexpr const __tuple_element_t<__i, tuple<_Elements...>>&
1401 {
return std::__get_helper<__i>(__t); }
1404 template<
size_t __i,
typename... _Elements>
1405 constexpr __tuple_element_t<__i, tuple<_Elements...>>&&
1408 typedef __tuple_element_t<__i,
tuple<_Elements...>> __element_type;
1409 return std::forward<__element_type>(std::__get_helper<__i>(__t));
1413 template<
size_t __i,
typename... _Elements>
1414 constexpr const __tuple_element_t<__i, tuple<_Elements...>>&&
1417 typedef __tuple_element_t<__i,
tuple<_Elements...>> __element_type;
1418 return std::forward<const __element_type>(std::__get_helper<__i>(__t));
1423 template<
size_t __i,
typename... _Elements>
1424 constexpr __enable_if_t<(__i >=
sizeof...(_Elements))>
1425 get(
const tuple<_Elements...>&) =
delete;
1428#if __cplusplus >= 201402L
1430#define __cpp_lib_tuples_by_type 201304L
1433 template <
typename _Tp,
typename... _Types>
1437 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1438 static_assert(__idx <
sizeof...(_Types),
1439 "the type T in std::get<T> must occur exactly once in the tuple");
1440 return std::__get_helper<__idx>(__t);
1444 template <
typename _Tp,
typename... _Types>
1448 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1449 static_assert(__idx <
sizeof...(_Types),
1450 "the type T in std::get<T> must occur exactly once in the tuple");
1451 return std::forward<_Tp>(std::__get_helper<__idx>(__t));
1455 template <
typename _Tp,
typename... _Types>
1456 constexpr const _Tp&
1459 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1460 static_assert(__idx <
sizeof...(_Types),
1461 "the type T in std::get<T> must occur exactly once in the tuple");
1462 return std::__get_helper<__idx>(__t);
1467 template <
typename _Tp,
typename... _Types>
1468 constexpr const _Tp&&
1471 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1472 static_assert(__idx <
sizeof...(_Types),
1473 "the type T in std::get<T> must occur exactly once in the tuple");
1474 return std::forward<const _Tp>(std::__get_helper<__idx>(__t));
1479 template<
typename _Tp,
typename _Up,
size_t __i,
size_t __size>
1480 struct __tuple_compare
1482 static constexpr bool
1483 __eq(
const _Tp& __t,
const _Up& __u)
1485 return bool(std::get<__i>(__t) == std::get<__i>(__u))
1486 && __tuple_compare<_Tp, _Up, __i + 1, __size>::__eq(__t, __u);
1489 static constexpr bool
1490 __less(
const _Tp& __t,
const _Up& __u)
1492 return bool(std::get<__i>(__t) < std::get<__i>(__u))
1493 || (!bool(std::get<__i>(__u) < std::get<__i>(__t))
1494 && __tuple_compare<_Tp, _Up, __i + 1, __size>::__less(__t, __u));
1498 template<
typename _Tp,
typename _Up,
size_t __size>
1499 struct __tuple_compare<_Tp, _Up, __size, __size>
1501 static constexpr bool
1502 __eq(
const _Tp&,
const _Up&) {
return true; }
1504 static constexpr bool
1505 __less(
const _Tp&,
const _Up&) {
return false; }
1508 template<
typename... _TElements,
typename... _UElements>
1510 operator==(
const tuple<_TElements...>& __t,
1511 const tuple<_UElements...>& __u)
1513 static_assert(
sizeof...(_TElements) ==
sizeof...(_UElements),
1514 "tuple objects can only be compared if they have equal sizes.");
1515 using __compare = __tuple_compare<tuple<_TElements...>,
1516 tuple<_UElements...>,
1517 0,
sizeof...(_TElements)>;
1518 return __compare::__eq(__t, __u);
1521#if __cpp_lib_three_way_comparison
1522 template<
typename _Cat,
typename _Tp,
typename _Up>
1524 __tuple_cmp(
const _Tp&,
const _Up&, index_sequence<>)
1525 {
return _Cat::equivalent; }
1527 template<
typename _Cat,
typename _Tp,
typename _Up,
1528 size_t _Idx0,
size_t... _Idxs>
1530 __tuple_cmp(
const _Tp& __t,
const _Up& __u,
1531 index_sequence<_Idx0, _Idxs...>)
1534 = __detail::__synth3way(std::get<_Idx0>(__t), std::get<_Idx0>(__u));
1537 return std::__tuple_cmp<_Cat>(__t, __u, index_sequence<_Idxs...>());
1540 template<
typename... _Tps,
typename... _Ups>
1542 common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...>
1543 operator<=>(
const tuple<_Tps...>& __t,
const tuple<_Ups...>& __u)
1546 = common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...>;
1547 return std::__tuple_cmp<_Cat>(__t, __u, index_sequence_for<_Tps...>());
1550 template<
typename... _TElements,
typename... _UElements>
1552 operator<(
const tuple<_TElements...>& __t,
1553 const tuple<_UElements...>& __u)
1555 static_assert(
sizeof...(_TElements) ==
sizeof...(_UElements),
1556 "tuple objects can only be compared if they have equal sizes.");
1557 using __compare = __tuple_compare<tuple<_TElements...>,
1558 tuple<_UElements...>,
1559 0,
sizeof...(_TElements)>;
1560 return __compare::__less(__t, __u);
1563 template<
typename... _TElements,
typename... _UElements>
1565 operator!=(
const tuple<_TElements...>& __t,
1566 const tuple<_UElements...>& __u)
1567 {
return !(__t == __u); }
1569 template<
typename... _TElements,
typename... _UElements>
1571 operator>(
const tuple<_TElements...>& __t,
1572 const tuple<_UElements...>& __u)
1573 {
return __u < __t; }
1575 template<
typename... _TElements,
typename... _UElements>
1577 operator<=(
const tuple<_TElements...>& __t,
1578 const tuple<_UElements...>& __u)
1579 {
return !(__u < __t); }
1581 template<
typename... _TElements,
typename... _UElements>
1583 operator>=(
const tuple<_TElements...>& __t,
1584 const tuple<_UElements...>& __u)
1585 {
return !(__t < __u); }
1590 template<
typename... _Elements>
1591 constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
1596 return __result_type(std::forward<_Elements>(__args)...);
1602 template<
typename... _Elements>
1603 constexpr tuple<_Elements&&...>
1605 {
return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
1610 template<
typename _Tp,
size_t _Nm>
struct array;
1612 template<
size_t _Int,
typename _Tp,
size_t _Nm>
1614 get(array<_Tp, _Nm>&)
noexcept;
1616 template<
size_t _Int,
typename _Tp,
size_t _Nm>
1618 get(array<_Tp, _Nm>&&) noexcept;
1620 template<
size_t _Int, typename _Tp,
size_t _Nm>
1621 constexpr const _Tp&
1622 get(const array<_Tp, _Nm>&) noexcept;
1624 template<
size_t _Int, typename _Tp,
size_t _Nm>
1625 constexpr const _Tp&&
1626 get(const array<_Tp, _Nm>&&) noexcept;
1629 template<
size_t, typename, typename,
size_t>
1630 struct __make_tuple_impl;
1632 template<
size_t _Idx, typename _Tuple, typename... _Tp,
size_t _Nm>
1633 struct __make_tuple_impl<_Idx, tuple<_Tp...>, _Tuple, _Nm>
1634 : __make_tuple_impl<_Idx + 1,
1635 tuple<_Tp..., __tuple_element_t<_Idx, _Tuple>>,
1639 template<
size_t _Nm,
typename _Tuple,
typename... _Tp>
1640 struct __make_tuple_impl<_Nm, tuple<_Tp...>, _Tuple, _Nm>
1642 typedef tuple<_Tp...> __type;
1645 template<
typename _Tuple>
1646 struct __do_make_tuple
1647 : __make_tuple_impl<0, tuple<>, _Tuple, tuple_size<_Tuple>::value>
1651 template<
typename _Tuple>
1653 :
public __do_make_tuple<__remove_cvref_t<_Tuple>>
1657 template<
typename...>
1658 struct __combine_tuples;
1661 struct __combine_tuples<>
1663 typedef tuple<> __type;
1666 template<
typename... _Ts>
1667 struct __combine_tuples<tuple<_Ts...>>
1669 typedef tuple<_Ts...> __type;
1672 template<
typename... _T1s,
typename... _T2s,
typename... _Rem>
1673 struct __combine_tuples<tuple<_T1s...>, tuple<_T2s...>, _Rem...>
1675 typedef typename __combine_tuples<tuple<_T1s..., _T2s...>,
1676 _Rem...>::__type __type;
1680 template<
typename... _Tpls>
1681 struct __tuple_cat_result
1683 typedef typename __combine_tuples
1684 <
typename __make_tuple<_Tpls>::__type...>::__type __type;
1689 template<
typename...>
1690 struct __make_1st_indices;
1693 struct __make_1st_indices<>
1695 typedef _Index_tuple<> __type;
1698 template<
typename _Tp,
typename... _Tpls>
1699 struct __make_1st_indices<_Tp, _Tpls...>
1701 typedef typename _Build_index_tuple<tuple_size<
1702 typename remove_reference<_Tp>::type>::value>::__type __type;
1708 template<
typename _Ret,
typename _Indices,
typename... _Tpls>
1709 struct __tuple_concater;
1711 template<
typename _Ret,
size_t... _Is,
typename _Tp,
typename... _Tpls>
1712 struct __tuple_concater<_Ret, _Index_tuple<_Is...>, _Tp, _Tpls...>
1714 template<
typename... _Us>
1715 static constexpr _Ret
1716 _S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us)
1718 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
1719 typedef __tuple_concater<_Ret, __idx, _Tpls...> __next;
1720 return __next::_S_do(std::forward<_Tpls>(__tps)...,
1721 std::forward<_Us>(__us)...,
1722 std::get<_Is>(std::forward<_Tp>(__tp))...);
1726 template<
typename _Ret>
1727 struct __tuple_concater<_Ret, _Index_tuple<>>
1729 template<
typename... _Us>
1730 static constexpr _Ret
1731 _S_do(_Us&&... __us)
1733 return _Ret(std::forward<_Us>(__us)...);
1737 template<
typename... _Tps>
1738 struct __is_tuple_like_impl<tuple<_Tps...>> :
true_type
1743 template<
typename... _Tpls,
typename =
typename
1744 enable_if<__and_<__is_tuple_like<_Tpls>...>::value>::type>
1747 ->
typename __tuple_cat_result<_Tpls...>::__type
1749 typedef typename __tuple_cat_result<_Tpls...>::__type __ret;
1750 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
1751 typedef __tuple_concater<__ret, __idx, _Tpls...> __concater;
1752 return __concater::_S_do(std::forward<_Tpls>(__tpls)...);
1758 template<
typename... _Elements>
1759 constexpr tuple<_Elements&...>
1760 tie(_Elements&... __args)
noexcept
1761 {
return tuple<_Elements&...>(__args...); }
1764 template<
typename... _Elements>
1765 _GLIBCXX20_CONSTEXPR
1767#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
1769 typename enable_if<__and_<__is_swappable<_Elements>...>::value
1775 noexcept(
noexcept(__x.swap(__y)))
1778#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
1780 template<typename... _Elements>
1781 _GLIBCXX20_CONSTEXPR
1782 typename enable_if<!__and_<__is_swappable<_Elements>...>::value>::type
1783 swap(tuple<_Elements...>&, tuple<_Elements...>&) =
delete;
1790 struct _Swallow_assign
1793 _GLIBCXX14_CONSTEXPR
const _Swallow_assign&
1794 operator=(
const _Tp&)
const
1815 _GLIBCXX17_INLINE
constexpr _Swallow_assign
ignore{};
1818 template<
typename... _Types,
typename _Alloc>
1830 template<
class _T1,
class _T2>
1831 template<
typename... _Args1,
typename... _Args2>
1832 _GLIBCXX20_CONSTEXPR
1837 :
pair(__first, __second,
1838 typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
1839 typename _Build_index_tuple<sizeof...(_Args2)>::__type())