301 static constexpr const _Inherited&
302 _M_tail(
const _Tuple_impl& __t)
noexcept {
return __t; }
304 constexpr _Tuple_impl()
305 : _Inherited(), _Base() { }
308 _Tuple_impl(
const _Head& __head,
const _Tail&... __tail)
309 : _Inherited(__tail...), _Base(__head)
312 template<
typename _UHead,
typename... _UTail,
313 typename = __enable_if_t<
sizeof...(_Tail) ==
sizeof...(_UTail)>>
315 _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
316 : _Inherited(
std::
forward<_UTail>(__tail)...),
320 constexpr _Tuple_impl(
const _Tuple_impl&) =
default;
324 _Tuple_impl& operator=(
const _Tuple_impl&) =
delete;
326 _Tuple_impl(_Tuple_impl&&) =
default;
328 template<
typename... _UElements>
330 _Tuple_impl(
const _Tuple_impl<_Idx, _UElements...>& __in)
331 : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
332 _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in))
335 template<
typename _UHead,
typename... _UTails>
337 _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
339 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
341 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
344#if __cpp_lib_ranges_zip
345 template<
typename... _UElements>
347 _Tuple_impl(_Tuple_impl<_Idx, _UElements...>& __in)
348 : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
349 _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in))
352 template<
typename _UHead,
typename... _UTails>
354 _Tuple_impl(
const _Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
356 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
358 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
362#if __cpp_lib_tuple_like
363 template<
typename _UTuple,
size_t... _Is>
365 _Tuple_impl(__tuple_like_tag_t, _UTuple&& __u, index_sequence<_Is...>)
370 template<
typename _Alloc>
372 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a)
373 : _Inherited(__tag, __a),
374 _Base(__tag, __use_alloc<_Head>(__a))
377 template<
typename _Alloc>
379 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
380 const _Head& __head,
const _Tail&... __tail)
381 : _Inherited(__tag, __a, __tail...),
382 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head)
385 template<
typename _Alloc,
typename _UHead,
typename... _UTail,
386 typename = __enable_if_t<
sizeof...(_Tail) ==
sizeof...(_UTail)>>
388 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
389 _UHead&& __head, _UTail&&... __tail)
390 : _Inherited(__tag, __a,
std::
forward<_UTail>(__tail)...),
391 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
395 template<
typename _Alloc>
397 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
398 const _Tuple_impl& __in)
399 : _Inherited(__tag, __a, _M_tail(__in)),
400 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in))
403 template<
typename _Alloc>
405 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
407 : _Inherited(__tag, __a,
std::
move(_M_tail(__in))),
408 _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
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)
416 : _Inherited(__tag, __a,
417 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)),
418 _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a),
419 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))
422 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
424 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
425 _Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
426 : _Inherited(__tag, __a,
std::
move
427 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
428 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
430 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
433#if __cpp_lib_ranges_zip
434 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
436 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
437 _Tuple_impl<_Idx, _UHead, _UTails...>& __in)
438 : _Inherited(__tag, __a,
439 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)),
440 _Base(__use_alloc<_Head, _Alloc, _UHead&>(__a),
441 _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))
444 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
446 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a,
447 const _Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
448 : _Inherited(__tag, __a,
std::
move
449 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
450 _Base(__use_alloc<_Head, _Alloc, const _UHead>(__a),
452 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)))
456#if __cpp_lib_tuple_like
457 template<
typename _Alloc,
typename _UTuple,
size_t... _Is>
459 _Tuple_impl(__tuple_like_tag_t, allocator_arg_t __tag,
const _Alloc& __a,
460 _UTuple&& __u, index_sequence<_Is...>)
461 : _Tuple_impl(__tag, __a,
std::get<_Is>(
std::
forward<_UTuple>(__u))...)
465 template<
typename... _UElements>
468 _M_assign(
const _Tuple_impl<_Idx, _UElements...>& __in)
470 _M_head(*
this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in);
471 _M_tail(*this)._M_assign(
472 _Tuple_impl<_Idx, _UElements...>::_M_tail(__in));
475 template<
typename _UHead,
typename... _UTails>
478 _M_assign(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
480 _M_head(*
this) = std::forward<_UHead>
481 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in));
482 _M_tail(*this)._M_assign(
483 std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)));
486#if __cpp_lib_ranges_zip
487 template<
typename... _UElements>
489 _M_assign(
const _Tuple_impl<_Idx, _UElements...>& __in)
const
491 _M_head(*
this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in);
492 _M_tail(*this)._M_assign(
493 _Tuple_impl<_Idx, _UElements...>::_M_tail(__in));
496 template<
typename _UHead,
typename... _UTails>
498 _M_assign(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
const
500 _M_head(*
this) = std::forward<_UHead>
501 (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in));
502 _M_tail(*this)._M_assign(
503 std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)));
507#if __cpp_lib_tuple_like
508 template<
typename _UTuple>
510 _M_assign(__tuple_like_tag_t __tag, _UTuple&& __u)
512 _M_head(*
this) = std::get<_Idx>(std::forward<_UTuple>(__u));
513 _M_tail(*this)._M_assign(__tag, std::forward<_UTuple>(__u));
516 template<
typename _UTuple>
518 _M_assign(__tuple_like_tag_t __tag, _UTuple&& __u)
const
520 _M_head(*
this) = std::get<_Idx>(std::forward<_UTuple>(__u));
521 _M_tail(*this)._M_assign(__tag, std::forward<_UTuple>(__u));
528 _M_swap(_Tuple_impl& __in)
531 swap(_M_head(*
this), _M_head(__in));
532 _Inherited::_M_swap(_M_tail(__in));
535#if __cpp_lib_ranges_zip
537 _M_swap(
const _Tuple_impl& __in)
const
540 swap(_M_head(*
this), _M_head(__in));
541 _Inherited::_M_swap(_M_tail(__in));
547 template<
size_t _Idx,
typename _Head>
548 struct _Tuple_impl<_Idx, _Head>
549 :
private _Head_base<_Idx, _Head>
551 template<size_t,
typename...>
friend struct _Tuple_impl;
553 typedef _Head_base<_Idx, _Head> _Base;
555 static constexpr _Head&
556 _M_head(_Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
558 static constexpr const _Head&
559 _M_head(
const _Tuple_impl& __t)
noexcept {
return _Base::_M_head(__t); }
566 _Tuple_impl(
const _Head& __head)
570 template<
typename _UHead>
572 _Tuple_impl(_UHead&& __head)
576 constexpr _Tuple_impl(
const _Tuple_impl&) =
default;
580 _Tuple_impl& operator=(
const _Tuple_impl&) =
delete;
582#if _GLIBCXX_INLINE_VERSION
583 _Tuple_impl(_Tuple_impl&&) =
default;
586 _Tuple_impl(_Tuple_impl&& __in)
587 noexcept(is_nothrow_move_constructible<_Head>::value)
588 : _Base(static_cast<_Base&&>(__in))
592 template<
typename _UHead>
594 _Tuple_impl(
const _Tuple_impl<_Idx, _UHead>& __in)
595 : _Base(_Tuple_impl<_Idx, _UHead>::_M_head(__in))
598 template<
typename _UHead>
600 _Tuple_impl(_Tuple_impl<_Idx, _UHead>&& __in)
601 : _Base(
std::
forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
604#if __cpp_lib_ranges_zip
605 template<
typename _UHead>
607 _Tuple_impl(_Tuple_impl<_Idx, _UHead>& __in)
608 : _Base(_Tuple_impl<_Idx, _UHead>::_M_head(__in))
611 template<
typename _UHead>
613 _Tuple_impl(
const _Tuple_impl<_Idx, _UHead>&& __in)
614 : _Base(
std::
forward<const _UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
618#if __cpp_lib_tuple_like
619 template<
typename _UTuple>
621 _Tuple_impl(__tuple_like_tag_t, _UTuple&& __u, index_sequence<0>)
626 template<
typename _Alloc>
628 _Tuple_impl(allocator_arg_t __tag,
const _Alloc& __a)
629 : _Base(__tag, __use_alloc<_Head>(__a))
632 template<
typename _Alloc>
634 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
636 : _Base(__use_alloc<_Head, _Alloc, const _Head&>(__a), __head)
639 template<
typename _Alloc,
typename _UHead>
641 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
643 : _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
647 template<
typename _Alloc>
649 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
650 const _Tuple_impl& __in)
651 : _Base(__use_alloc<_Head, _Alloc, const _Head&>(__a), _M_head(__in))
654 template<
typename _Alloc>
656 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
658 : _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
662 template<
typename _Alloc,
typename _UHead>
664 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
665 const _Tuple_impl<_Idx, _UHead>& __in)
666 : _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a),
667 _Tuple_impl<_Idx, _UHead>::_M_head(__in))
670 template<
typename _Alloc,
typename _UHead>
672 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
673 _Tuple_impl<_Idx, _UHead>&& __in)
674 : _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
675 std::
forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
678#if __cpp_lib_ranges_zip
679 template<
typename _Alloc,
typename _UHead>
681 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
682 _Tuple_impl<_Idx, _UHead>& __in)
683 : _Base(__use_alloc<_Head, _Alloc, _UHead&>(__a),
684 _Tuple_impl<_Idx, _UHead>::_M_head(__in))
687 template<
typename _Alloc,
typename _UHead>
689 _Tuple_impl(allocator_arg_t,
const _Alloc& __a,
690 const _Tuple_impl<_Idx, _UHead>&& __in)
691 : _Base(__use_alloc<_Head, _Alloc, const _UHead>(__a),
692 std::
forward<const _UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
696#if __cpp_lib_tuple_like
697 template<
typename _Alloc,
typename _UTuple>
699 _Tuple_impl(__tuple_like_tag_t, allocator_arg_t __tag,
const _Alloc& __a,
700 _UTuple&& __u, index_sequence<0>)
701 : _Tuple_impl(__tag, __a,
std::get<0>(
std::
forward<_UTuple>(__u)))
705 template<
typename _UHead>
708 _M_assign(
const _Tuple_impl<_Idx, _UHead>& __in)
710 _M_head(*
this) = _Tuple_impl<_Idx, _UHead>::_M_head(__in);
713 template<
typename _UHead>
716 _M_assign(_Tuple_impl<_Idx, _UHead>&& __in)
719 = std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in));
722#if __cpp_lib_ranges_zip
723 template<
typename _UHead>
725 _M_assign(
const _Tuple_impl<_Idx, _UHead>& __in)
const
727 _M_head(*
this) = _Tuple_impl<_Idx, _UHead>::_M_head(__in);
730 template<
typename _UHead>
732 _M_assign(_Tuple_impl<_Idx, _UHead>&& __in)
const
735 = std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in));
739#if __cpp_lib_tuple_like
740 template<
typename _UTuple>
742 _M_assign(__tuple_like_tag_t, _UTuple&& __u)
743 { _M_head(*
this) = std::get<_Idx>(std::forward<_UTuple>(__u)); }
745 template<
typename _UTuple>
747 _M_assign(__tuple_like_tag_t, _UTuple&& __u)
const
748 { _M_head(*
this) = std::get<_Idx>(std::forward<_UTuple>(__u)); }
754 _M_swap(_Tuple_impl& __in)
757 swap(_M_head(*
this), _M_head(__in));
760#if __cpp_lib_ranges_zip
762 _M_swap(
const _Tuple_impl& __in)
const
765 swap(_M_head(*
this), _M_head(__in));
772 template<bool,
typename... _Types>
773 struct _TupleConstraints
775 template<
typename... _UTypes>
776 using __constructible = __and_<is_constructible<_Types, _UTypes>...>;
778 template<
typename... _UTypes>
779 using __convertible = __and_<is_convertible<_UTypes, _Types>...>;
784 template<
typename... _UTypes>
785 static constexpr bool __is_implicitly_constructible()
787 return __and_<__constructible<_UTypes...>,
788 __convertible<_UTypes...>
795 template<
typename... _UTypes>
796 static constexpr bool __is_explicitly_constructible()
798 return __and_<__constructible<_UTypes...>,
799 __not_<__convertible<_UTypes...>>
803 static constexpr bool __is_implicitly_default_constructible()
805 return __and_<std::__is_implicitly_default_constructible<_Types>...
809 static constexpr bool __is_explicitly_default_constructible()
811 return __and_<is_default_constructible<_Types>...,
813 std::__is_implicitly_default_constructible<_Types>...>
820 template<
typename... _Types>
821 struct _TupleConstraints<false, _Types...>
823 template<
typename... _UTypes>
824 static constexpr bool __is_implicitly_constructible()
827 template<
typename... _UTypes>
828 static constexpr bool __is_explicitly_constructible()
833 template<
typename... _Elements>
838#if __cpp_concepts && __cpp_consteval && __cpp_conditional_explicit
839 template<
typename... _UTypes>
840 static consteval bool
843 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
849 template<
typename... _UTypes>
850 static consteval bool
851 __nothrow_constructible()
853 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
859 template<
typename... _UTypes>
860 static consteval bool
863 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
871 template<
typename... _UTypes>
872 static consteval bool
873 __disambiguating_constraint()
875 if constexpr (
sizeof...(_Elements) !=
sizeof...(_UTypes))
877 else if constexpr (
sizeof...(_Elements) == 1)
879 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
880 return !is_same_v<remove_cvref_t<_U0>,
tuple>;
882 else if constexpr (
sizeof...(_Elements) < 4)
884 using _U0 =
typename _Nth_type<0, _UTypes...>::type;
885 if constexpr (!is_same_v<remove_cvref_t<_U0>, allocator_arg_t>)
889 using _T0 =
typename _Nth_type<0, _Elements...>::type;
890 return is_same_v<remove_cvref_t<_T0>, allocator_arg_t>;
899 template<
typename _Tuple>
900 static consteval bool
903 if constexpr (
sizeof...(_Elements) != 1)
905 else if constexpr (is_same_v<remove_cvref_t<_Tuple>,
tuple>)
909 using _Tp =
typename _Nth_type<0, _Elements...>::type;
910 if constexpr (is_convertible_v<_Tuple, _Tp>)
912 else if constexpr (is_constructible_v<_Tp, _Tuple>)
918 template<
typename... _Up>
919 static consteval bool
922#if __has_builtin(__reference_constructs_from_temporary)
923 return (__reference_constructs_from_temporary(_Elements, _Up&&)
930#if __cpp_lib_tuple_like
933 template<
typename _UTuple>
934 static consteval bool
935 __dangles_from_tuple_like()
938 return __dangles<decltype(std::get<_Is>(std::declval<_UTuple>()))...>();
942 template<
typename _UTuple>
943 static consteval bool
944 __constructible_from_tuple_like()
947 return __constructible<decltype(std::get<_Is>(std::declval<_UTuple>()))...>();
951 template<
typename _UTuple>
952 static consteval bool
953 __convertible_from_tuple_like()
956 return __convertible<decltype(std::get<_Is>(std::declval<_UTuple>()))...>();
963 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
965 noexcept((is_nothrow_default_constructible_v<_Elements> && ...))
966 requires (is_default_constructible_v<_Elements> && ...)
970 constexpr explicit(!__convertible<
const _Elements&...>())
971 tuple(
const _Elements&... __elements)
972 noexcept(__nothrow_constructible<
const _Elements&...>())
973 requires (__constructible<
const _Elements&...>())
977 template<
typename... _UTypes>
978 requires (__disambiguating_constraint<_UTypes...>())
979 && (__constructible<_UTypes...>())
980 && (!__dangles<_UTypes...>())
981 constexpr explicit(!__convertible<_UTypes...>())
982 tuple(_UTypes&&... __u)
983 noexcept(__nothrow_constructible<_UTypes...>())
987 template<
typename... _UTypes>
988 requires (__disambiguating_constraint<_UTypes...>())
989 && (__constructible<_UTypes...>())
990 && (__dangles<_UTypes...>())
991 tuple(_UTypes&&...) =
delete;
997 template<
typename... _UTypes>
998 requires (__constructible<
const _UTypes&...>())
999 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1000 && (!__dangles<
const _UTypes&...>())
1001 constexpr explicit(!__convertible<
const _UTypes&...>())
1003 noexcept(__nothrow_constructible<
const _UTypes&...>())
1007 template<
typename... _UTypes>
1008 requires (__constructible<
const _UTypes&...>())
1009 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1010 && (__dangles<
const _UTypes&...>())
1013 template<
typename... _UTypes>
1014 requires (__constructible<_UTypes...>())
1015 && (!__use_other_ctor<
tuple<_UTypes...>>())
1016 && (!__dangles<_UTypes...>())
1017 constexpr explicit(!__convertible<_UTypes...>())
1019 noexcept(__nothrow_constructible<_UTypes...>())
1023 template<
typename... _UTypes>
1024 requires (__constructible<_UTypes...>())
1025 && (!__use_other_ctor<
tuple<_UTypes...>>())
1026 && (__dangles<_UTypes...>())
1029#if __cpp_lib_ranges_zip
1030 template<
typename... _UTypes>
1031 requires (__constructible<_UTypes&...>())
1032 && (!__use_other_ctor<
tuple<_UTypes...>&>())
1033 && (!__dangles<_UTypes&...>())
1034 constexpr explicit(!__convertible<_UTypes&...>())
1036 noexcept(__nothrow_constructible<_UTypes&...>())
1040 template<
typename... _UTypes>
1041 requires (__constructible<_UTypes&...>())
1042 && (!__use_other_ctor<
tuple<_UTypes...>&>())
1043 && (__dangles<_UTypes&...>())
1046 template<
typename... _UTypes>
1047 requires (__constructible<
const _UTypes...>())
1048 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1049 && (!__dangles<
const _UTypes...>())
1050 constexpr explicit(!__convertible<
const _UTypes...>())
1052 noexcept(__nothrow_constructible<
const _UTypes...>())
1056 template<
typename... _UTypes>
1057 requires (__constructible<
const _UTypes...>())
1058 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1059 && (__dangles<
const _UTypes...>())
1063 template<
typename _U1,
typename _U2>
1064 requires (
sizeof...(_Elements) == 2)
1065 && (__constructible<const _U1&, const _U2&>())
1066 && (!__dangles<const _U1&, const _U2&>())
1067 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1069 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1073 template<
typename _U1,
typename _U2>
1074 requires (
sizeof...(_Elements) == 2)
1075 && (__constructible<const _U1&, const _U2&>())
1076 && (__dangles<const _U1&, const _U2&>())
1079 template<
typename _U1,
typename _U2>
1080 requires (
sizeof...(_Elements) == 2)
1081 && (__constructible<_U1, _U2>())
1082 && (!__dangles<_U1, _U2>())
1083 constexpr explicit(!__convertible<_U1, _U2>())
1085 noexcept(__nothrow_constructible<_U1, _U2>())
1087 std::forward<_U2>(__u.second))
1090 template<
typename _U1,
typename _U2>
1091 requires (
sizeof...(_Elements) == 2)
1092 && (__constructible<_U1, _U2>())
1093 && (__dangles<_U1, _U2>())
1096#if __cpp_lib_ranges_zip
1097 template<
typename _U1,
typename _U2>
1098 requires (
sizeof...(_Elements) == 2)
1099 && (__constructible<_U1&, _U2&>())
1100 && (!__dangles<_U1&, _U2&>())
1101 constexpr explicit(!__convertible<_U1&, _U2&>())
1103 noexcept(__nothrow_constructible<_U1&, _U2&>())
1107 template<
typename _U1,
typename _U2>
1108 requires (
sizeof...(_Elements) == 2)
1109 && (__constructible<_U1&, _U2&>())
1110 && (__dangles<_U1&, _U2&>())
1113 template<
typename _U1,
typename _U2>
1114 requires (
sizeof...(_Elements) == 2)
1115 && (__constructible<const _U1, const _U2>())
1116 && (!__dangles<const _U1, const _U2>())
1117 constexpr explicit(!__convertible<const _U1, const _U2>())
1119 noexcept(__nothrow_constructible<const _U1, const _U2>())
1120 :
_Inherited(std::forward<const _U1>(__u.first),
1121 std::forward<const _U2>(__u.second))
1124 template<
typename _U1,
typename _U2>
1125 requires (
sizeof...(_Elements) == 2)
1126 && (__constructible<const _U1, const _U2>())
1127 && (__dangles<const _U1, const _U2>())
1131#if __cpp_lib_tuple_like
1132 template<__eligible_tuple_like<tuple> _UTuple>
1133 requires (__constructible_from_tuple_like<_UTuple>())
1134 && (!__use_other_ctor<_UTuple>())
1135 && (!__dangles_from_tuple_like<_UTuple>())
1136 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1137 tuple(_UTuple&& __u)
1139 std::forward<_UTuple>(__u),
1143 template<__eligible_tuple_like<tuple> _UTuple>
1144 requires (__constructible_from_tuple_like<_UTuple>())
1145 && (!__use_other_ctor<_UTuple>())
1146 && (__dangles_from_tuple_like<_UTuple>())
1147 tuple(_UTuple&&) =
delete;
1152 template<
typename _Alloc>
1154 explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...))
1155 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1156 requires (is_default_constructible_v<_Elements> && ...)
1160 template<
typename _Alloc>
1161 constexpr explicit(!__convertible<
const _Elements&...>())
1162 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1163 const _Elements&... __elements)
1164 requires (__constructible<
const _Elements&...>())
1168 template<
typename _Alloc,
typename... _UTypes>
1169 requires (__disambiguating_constraint<_UTypes...>())
1170 && (__constructible<_UTypes...>())
1171 && (!__dangles<_UTypes...>())
1172 constexpr explicit(!__convertible<_UTypes...>())
1173 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTypes&&... __u)
1174 :
_Inherited(__tag, __a, std::forward<_UTypes>(__u)...)
1177 template<
typename _Alloc,
typename... _UTypes>
1178 requires (__disambiguating_constraint<_UTypes...>())
1179 && (__constructible<_UTypes...>())
1180 && (__dangles<_UTypes...>())
1181 tuple(allocator_arg_t,
const _Alloc&, _UTypes&&...) =
delete;
1183 template<
typename _Alloc>
1185 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __u)
1189 template<
typename _Alloc>
1190 requires (__constructible<_Elements...>())
1192 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __u)
1196 template<
typename _Alloc,
typename... _UTypes>
1197 requires (__constructible<
const _UTypes&...>())
1198 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1199 && (!__dangles<
const _UTypes&...>())
1200 constexpr explicit(!__convertible<
const _UTypes&...>())
1201 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1204 static_cast<const _Tuple_impl<0, _UTypes...
>&>(__u))
1207 template<
typename _Alloc,
typename... _UTypes>
1208 requires (__constructible<
const _UTypes&...>())
1209 && (!__use_other_ctor<
const tuple<_UTypes...>&>())
1210 && (__dangles<
const _UTypes&...>())
1213 template<
typename _Alloc,
typename... _UTypes>
1214 requires (__constructible<_UTypes...>())
1215 && (!__use_other_ctor<
tuple<_UTypes...>>())
1216 && (!__dangles<_UTypes...>())
1217 constexpr explicit(!__use_other_ctor<
tuple<_UTypes...>>())
1222 template<
typename _Alloc,
typename... _UTypes>
1223 requires (__constructible<_UTypes...>())
1224 && (!__use_other_ctor<
tuple<_UTypes...>>())
1225 && (__dangles<_UTypes...>())
1228#if __cpp_lib_ranges_zip
1229 template<
typename _Alloc,
typename... _UTypes>
1230 requires (__constructible<_UTypes&...>())
1231 && (!__use_other_ctor<
tuple<_UTypes...>&>())
1232 && (!__dangles<_UTypes&...>())
1233 constexpr explicit(!__convertible<_UTypes&...>())
1238 template<
typename _Alloc,
typename... _UTypes>
1239 requires (__constructible<_UTypes&...>())
1240 && (!__use_other_ctor<
tuple<_UTypes...>&>())
1241 && (__dangles<_UTypes&...>())
1244 template<
typename _Alloc,
typename... _UTypes>
1245 requires (__constructible<
const _UTypes...>())
1246 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1247 && (!__dangles<
const _UTypes...>())
1248 constexpr explicit(!__convertible<
const _UTypes...>())
1249 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1252 static_cast<const _Tuple_impl<0, _UTypes...
>&&>(__u))
1255 template<
typename _Alloc,
typename... _UTypes>
1256 requires (__constructible<
const _UTypes...>())
1257 && (!__use_other_ctor<
const tuple<_UTypes...>>())
1258 && (__dangles<
const _UTypes...>())
1262 template<
typename _Alloc,
typename _U1,
typename _U2>
1263 requires (
sizeof...(_Elements) == 2)
1264 && (__constructible<const _U1&, const _U2&>())
1265 && (!__dangles<const _U1&, const _U2&>())
1266 constexpr explicit(!__convertible<const _U1&, const _U2&>())
1267 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1269 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1270 :
_Inherited(__tag, __a, __u.first, __u.second)
1273 template<
typename _Alloc,
typename _U1,
typename _U2>
1274 requires (
sizeof...(_Elements) == 2)
1275 && (__constructible<const _U1&, const _U2&>())
1276 && (__dangles<const _U1&, const _U2&>())
1279 template<
typename _Alloc,
typename _U1,
typename _U2>
1280 requires (
sizeof...(_Elements) == 2)
1281 && (__constructible<_U1, _U2>())
1282 && (!__dangles<_U1, _U2>())
1283 constexpr explicit(!__convertible<_U1, _U2>())
1285 noexcept(__nothrow_constructible<_U1, _U2>())
1289 template<
typename _Alloc,
typename _U1,
typename _U2>
1290 requires (
sizeof...(_Elements) == 2)
1291 && (__constructible<_U1, _U2>())
1292 && (__dangles<_U1, _U2>())
1295#if __cpp_lib_ranges_zip
1296 template<
typename _Alloc,
typename _U1,
typename _U2>
1297 requires (
sizeof...(_Elements) == 2)
1298 && (__constructible<_U1&, _U2&>())
1299 && (!__dangles<_U1&, _U2&>())
1300 constexpr explicit(!__convertible<_U1&, _U2&>())
1302 noexcept(__nothrow_constructible<_U1&, _U2&>())
1303 :
_Inherited(__tag, __a, __u.first, __u.second)
1306 template<
typename _Alloc,
typename _U1,
typename _U2>
1307 requires (
sizeof...(_Elements) == 2)
1308 && (__constructible<_U1&, _U2&>())
1309 && (__dangles<_U1&, _U2&>())
1312 template<
typename _Alloc,
typename _U1,
typename _U2>
1313 requires (
sizeof...(_Elements) == 2)
1314 && (__constructible<const _U1, const _U2>())
1315 && (!__dangles<const _U1, const _U2>())
1316 constexpr explicit(!__convertible<const _U1, const _U2>())
1317 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1319 noexcept(__nothrow_constructible<const _U1, const _U2>())
1323 template<
typename _Alloc,
typename _U1,
typename _U2>
1324 requires (
sizeof...(_Elements) == 2)
1325 && (__constructible<const _U1, const _U2>())
1326 && (__dangles<const _U1, const _U2>())
1330#if __cpp_lib_tuple_like
1331 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1332 requires (__constructible_from_tuple_like<_UTuple>())
1333 && (!__use_other_ctor<_UTuple>())
1334 && (!__dangles_from_tuple_like<_UTuple>())
1335 constexpr explicit(!__convertible_from_tuple_like<_UTuple>())
1336 tuple(allocator_arg_t __tag,
const _Alloc& __a, _UTuple&& __u)
1338 __tag, __a, std::forward<_UTuple>(__u),
1342 template<
typename _Alloc, __eligible_tuple_like<tuple> _UTuple>
1343 requires (__constructible_from_tuple_like<_UTuple>())
1344 && (!__use_other_ctor<_UTuple>())
1345 && (__dangles_from_tuple_like<_UTuple>())
1346 tuple(allocator_arg_t,
const _Alloc&, _UTuple&&) =
delete;
1351 template<
bool _Cond>
1352 using _TCC = _TupleConstraints<_Cond, _Elements...>;
1355 template<
bool _Dummy>
1356 using _ImplicitDefaultCtor = __enable_if_t<
1357 _TCC<_Dummy>::__is_implicitly_default_constructible(),
1361 template<
bool _Dummy>
1362 using _ExplicitDefaultCtor = __enable_if_t<
1363 _TCC<_Dummy>::__is_explicitly_default_constructible(),
1367 template<
bool _Cond,
typename... _Args>
1368 using _ImplicitCtor = __enable_if_t<
1369 _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(),
1373 template<
bool _Cond,
typename... _Args>
1374 using _ExplicitCtor = __enable_if_t<
1375 _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
1379 template<
typename... _UElements>
1380 static constexpr bool __nothrow_constructible()
1383 __and_<is_nothrow_constructible<_Elements, _UElements>...>::value;
1387 template<
typename _Up>
1388 static constexpr bool __valid_args()
1390 return sizeof...(_Elements) == 1
1395 template<
typename,
typename,
typename... _Tail>
1396 static constexpr bool __valid_args()
1397 {
return (
sizeof...(_Tail) + 2) ==
sizeof...(_Elements); }
1408 template<
typename _Tuple,
typename =
tuple,
1409 typename = __remove_cvref_t<_Tuple>>
1410 struct _UseOtherCtor
1415 template<
typename _Tuple,
typename _Tp,
typename _Up>
1416 struct _UseOtherCtor<_Tuple,
tuple<_Tp>,
tuple<_Up>>
1417 : __or_<is_convertible<_Tuple, _Tp>, is_constructible<_Tp, _Tuple>>::type
1421 template<
typename _Tuple,
typename _Tp>
1422 struct _UseOtherCtor<_Tuple,
tuple<_Tp>,
tuple<_Tp>>
1429 template<
typename _Tuple>
1430 static constexpr bool __use_other_ctor()
1431 {
return _UseOtherCtor<_Tuple>::value; }
1434#undef __glibcxx_no_dangling_refs
1435#if __has_builtin(__reference_constructs_from_temporary) \
1436 && defined _GLIBCXX_DEBUG
1438# if __cpp_fold_expressions
1439# define __glibcxx_dangling_refs(U) \
1440 (__reference_constructs_from_temporary(_Elements, U) || ...)
1442# define __glibcxx_dangling_refs(U) \
1443 __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \
1446# define __glibcxx_no_dangling_refs(U) \
1447 static_assert(!__glibcxx_dangling_refs(U), \
1448 "std::tuple constructor creates a dangling reference")
1450# define __glibcxx_no_dangling_refs(U)
1455 template<
typename _Dummy = void,
1456 _ImplicitDefaultCtor<is_void<_Dummy>::value> =
true>
1459 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1462 template<
typename _Dummy = void,
1463 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
1466 noexcept(__and_<is_nothrow_default_constructible<_Elements>...>::value)
1469 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1470 _ImplicitCtor<_NotEmpty,
const _Elements&...> =
true>
1472 tuple(
const _Elements&... __elements)
1473 noexcept(__nothrow_constructible<
const _Elements&...>())
1476 template<
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1477 _ExplicitCtor<_NotEmpty,
const _Elements&...> =
false>
1479 tuple(
const _Elements&... __elements)
1480 noexcept(__nothrow_constructible<
const _Elements&...>())
1483 template<
typename... _UElements,
1484 bool _Valid = __valid_args<_UElements...>(),
1485 _ImplicitCtor<_Valid, _UElements...> =
true>
1487 tuple(_UElements&&... __elements)
1488 noexcept(__nothrow_constructible<_UElements...>())
1489 :
_Inherited(std::forward<_UElements>(__elements)...)
1490 { __glibcxx_no_dangling_refs(_UElements&&); }
1492 template<
typename... _UElements,
1493 bool _Valid = __valid_args<_UElements...>(),
1494 _ExplicitCtor<_Valid, _UElements...> =
false>
1496 tuple(_UElements&&... __elements)
1497 noexcept(__nothrow_constructible<_UElements...>())
1498 :
_Inherited(std::forward<_UElements>(__elements)...)
1499 { __glibcxx_no_dangling_refs(_UElements&&); }
1505 template<
typename... _UElements,
1506 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1508 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1511 noexcept(__nothrow_constructible<
const _UElements&...>())
1513 { __glibcxx_no_dangling_refs(
const _UElements&); }
1515 template<
typename... _UElements,
1516 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1518 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1521 noexcept(__nothrow_constructible<
const _UElements&...>())
1523 { __glibcxx_no_dangling_refs(
const _UElements&); }
1525 template<
typename... _UElements,
1526 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1528 _ImplicitCtor<_Valid, _UElements...> =
true>
1531 noexcept(__nothrow_constructible<_UElements...>())
1533 { __glibcxx_no_dangling_refs(_UElements&&); }
1535 template<
typename... _UElements,
1536 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1538 _ExplicitCtor<_Valid, _UElements...> =
false>
1541 noexcept(__nothrow_constructible<_UElements...>())
1543 { __glibcxx_no_dangling_refs(_UElements&&); }
1547 template<
typename _Alloc,
1548 _ImplicitDefaultCtor<is_object<_Alloc>::value> =
true>
1549 _GLIBCXX20_CONSTEXPR
1550 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1553 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1554 _ImplicitCtor<_NotEmpty,
const _Elements&...> =
true>
1555 _GLIBCXX20_CONSTEXPR
1556 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1557 const _Elements&... __elements)
1560 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
1561 _ExplicitCtor<_NotEmpty,
const _Elements&...> =
false>
1562 _GLIBCXX20_CONSTEXPR
1564 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1565 const _Elements&... __elements)
1568 template<
typename _Alloc,
typename... _UElements,
1569 bool _Valid = __valid_args<_UElements...>(),
1570 _ImplicitCtor<_Valid, _UElements...> =
true>
1571 _GLIBCXX20_CONSTEXPR
1572 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1573 _UElements&&... __elements)
1574 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
1575 { __glibcxx_no_dangling_refs(_UElements&&); }
1577 template<
typename _Alloc,
typename... _UElements,
1578 bool _Valid = __valid_args<_UElements...>(),
1579 _ExplicitCtor<_Valid, _UElements...> =
false>
1580 _GLIBCXX20_CONSTEXPR
1582 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1583 _UElements&&... __elements)
1584 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
1585 { __glibcxx_no_dangling_refs(_UElements&&); }
1587 template<
typename _Alloc>
1588 _GLIBCXX20_CONSTEXPR
1589 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1592 template<
typename _Alloc>
1593 _GLIBCXX20_CONSTEXPR
1594 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
1597 template<
typename _Alloc,
typename... _UElements,
1598 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1600 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
1601 _GLIBCXX20_CONSTEXPR
1602 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1605 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1606 { __glibcxx_no_dangling_refs(
const _UElements&); }
1608 template<
typename _Alloc,
typename... _UElements,
1609 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1611 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
1612 _GLIBCXX20_CONSTEXPR
1614 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1617 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
1618 { __glibcxx_no_dangling_refs(
const _UElements&); }
1620 template<
typename _Alloc,
typename... _UElements,
1621 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1623 _ImplicitCtor<_Valid, _UElements...> =
true>
1624 _GLIBCXX20_CONSTEXPR
1625 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1628 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1629 { __glibcxx_no_dangling_refs(_UElements&&); }
1631 template<
typename _Alloc,
typename... _UElements,
1632 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
1634 _ExplicitCtor<_Valid, _UElements...> =
false>
1635 _GLIBCXX20_CONSTEXPR
1637 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1640 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
1641 { __glibcxx_no_dangling_refs(_UElements&&); }
1646#if __cpp_concepts && __cpp_consteval
1648 template<
typename... _UTypes>
1649 static consteval bool
1652 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1658 template<
typename... _UTypes>
1659 static consteval bool
1660 __nothrow_assignable()
1662 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1668#if __cpp_lib_ranges_zip
1669 template<
typename... _UTypes>
1670 static consteval bool
1671 __const_assignable()
1673 if constexpr (
sizeof...(_UTypes) ==
sizeof...(_Elements))
1680#if __cpp_lib_tuple_like
1681 template<
typename _UTuple>
1682 static consteval bool
1683 __assignable_from_tuple_like()
1686 return __assignable<decltype(std::get<_Is>(std::declval<_UTuple>()))...>();
1690 template<
typename _UTuple>
1691 static consteval bool
1692 __const_assignable_from_tuple_like()
1695 return __const_assignable<decltype(std::get<_Is>(std::declval<_UTuple>()))...>();
1705 operator=(
const tuple& __u)
1706 noexcept(__nothrow_assignable<
const _Elements&...>())
1707 requires (__assignable<
const _Elements&...>())
1709 this->_M_assign(__u);
1714 operator=(
tuple&& __u)
1715 noexcept(__nothrow_assignable<_Elements...>())
1716 requires (__assignable<_Elements...>())
1722 template<
typename... _UTypes>
1723 requires (__assignable<
const _UTypes&...>())
1726 noexcept(__nothrow_assignable<
const _UTypes&...>())
1728 this->_M_assign(__u);
1732 template<
typename... _UTypes>
1733 requires (__assignable<_UTypes...>())
1736 noexcept(__nothrow_assignable<_UTypes...>())
1742#if __cpp_lib_ranges_zip
1743 constexpr const tuple&
1744 operator=(
const tuple& __u)
const
1745 requires (__const_assignable<
const _Elements&...>())
1747 this->_M_assign(__u);
1751 constexpr const tuple&
1752 operator=(
tuple&& __u)
const
1753 requires (__const_assignable<_Elements...>())
1759 template<
typename... _UTypes>
1760 constexpr const tuple&
1762 requires (__const_assignable<
const _UTypes&...>())
1764 this->_M_assign(__u);
1768 template<
typename... _UTypes>
1769 constexpr const tuple&
1771 requires (__const_assignable<_UTypes...>())
1778 template<
typename _U1,
typename _U2>
1779 requires (__assignable<const _U1&, const _U2&>())
1782 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1784 this->_M_head(*
this) = __u.first;
1785 this->_M_tail(*this)._M_head(*
this) = __u.second;
1789 template<
typename _U1,
typename _U2>
1790 requires (__assignable<_U1, _U2>())
1793 noexcept(__nothrow_assignable<_U1, _U2>())
1795 this->_M_head(*
this) = std::forward<_U1>(__u.first);
1796 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__u.second);
1800#if __cpp_lib_ranges_zip
1801 template<
typename _U1,
typename _U2>
1802 requires (__const_assignable<const _U1&, const _U2>())
1803 constexpr const tuple&
1806 this->_M_head(*
this) = __u.first;
1807 this->_M_tail(*this)._M_head(*
this) = __u.second;
1811 template<
typename _U1,
typename _U2>
1812 requires (__const_assignable<_U1, _U2>())
1813 constexpr const tuple&
1816 this->_M_head(*
this) = std::forward<_U1>(__u.first);
1817 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__u.second);
1822#if __cpp_lib_tuple_like
1823 template<__eligible_tuple_like<tuple> _UTuple>
1824 requires (__assignable_from_tuple_like<_UTuple>())
1826 operator=(_UTuple&& __u)
1828 this->_M_assign(__tuple_like_tag_t{}, std::forward<_UTuple>(__u));
1832 template<__eligible_tuple_like<tuple> _UTuple>
1833 requires (__const_assignable_from_tuple_like<_UTuple>())
1834 constexpr const tuple&
1835 operator=(_UTuple&& __u)
const
1837 this->_M_assign(__tuple_like_tag_t{}, std::forward<_UTuple>(__u));
1841 template<__tuple_like _UTuple>
1842 requires (!__is_tuple_v<_UTuple>)
1843 friend constexpr bool
1844 operator==(
const tuple& __t,
const _UTuple& __u)
1846 static_assert(
sizeof...(_Elements) == tuple_size_v<_UTuple>,
1847 "tuple objects can only be compared if they have equal sizes.");
1849 return (
bool(std::get<_Is>(__t) == std::get<_Is>(__u))
1854 template<__tuple_like _UTuple,
1856 struct __tuple_like_common_comparison_category;
1858 template<__tuple_like _UTuple,
size_t... _Is>
1860 {
typename void_t<__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; }
1861 struct __tuple_like_common_comparison_category<_UTuple,
index_sequence<_Is...>>
1863 using type = common_comparison_category_t
1864 <__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>;
1867 template<__tuple_like _UTuple>
1868 requires (!__is_tuple_v<_UTuple>)
1869 friend constexpr typename __tuple_like_common_comparison_category<_UTuple>::type
1870 operator<=>(
const tuple& __t,
const _UTuple& __u)
1872 using _Cat =
typename __tuple_like_common_comparison_category<_UTuple>::type;
1880 template<
typename... _UElements>
1882 __enable_if_t<
sizeof...(_UElements) ==
sizeof...(_Elements),
bool>
1884 {
return __and_<is_assignable<_Elements&, _UElements>...>::value; }
1887 template<
typename... _UElements>
1888 static constexpr bool __nothrow_assignable()
1891 __and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
1896 _GLIBCXX20_CONSTEXPR
1898 operator=(__conditional_t<__assignable<const _Elements&...>(),
1900 const __nonesuch&> __in)
1901 noexcept(__nothrow_assignable<
const _Elements&...>())
1903 this->_M_assign(__in);
1907 _GLIBCXX20_CONSTEXPR
1909 operator=(__conditional_t<__assignable<_Elements...>(),
1912 noexcept(__nothrow_assignable<_Elements...>())
1918 template<
typename... _UElements>
1919 _GLIBCXX20_CONSTEXPR
1920 __enable_if_t<__assignable<
const _UElements&...>(),
tuple&>
1922 noexcept(__nothrow_assignable<
const _UElements&...>())
1924 this->_M_assign(__in);
1928 template<
typename... _UElements>
1929 _GLIBCXX20_CONSTEXPR
1930 __enable_if_t<__assignable<_UElements...>(),
tuple&>
1932 noexcept(__nothrow_assignable<_UElements...>())
1940 _GLIBCXX20_CONSTEXPR
1943 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
1944 { _Inherited::_M_swap(__in); }
1946#if __cpp_lib_ranges_zip
1954 swap(
const tuple& __in)
const
1955 noexcept(__and_v<__is_nothrow_swappable<const _Elements>...>)
1956 requires (is_swappable_v<const _Elements> && ...)
1957 { _Inherited::_M_swap(__in); }
1961#if __cpp_deduction_guides >= 201606
1962 template<
typename... _UTypes>
1964 template<
typename _T1,
typename _T2>
1966 template<
typename _Alloc,
typename... _UTypes>
1967 tuple(allocator_arg_t, _Alloc, _UTypes...) ->
tuple<_UTypes...>;
1968 template<
typename _Alloc,
typename _T1,
typename _T2>
1970 template<
typename _Alloc,
typename... _UTypes>
1979 _GLIBCXX20_CONSTEXPR
1980 void swap(
tuple&)
noexcept { }
1981#if __cpp_lib_ranges_zip
1982 constexpr void swap(
const tuple&)
const noexcept { }
1988 template<
typename _Alloc>
1989 _GLIBCXX20_CONSTEXPR
1990 tuple(allocator_arg_t,
const _Alloc&)
noexcept { }
1991 template<
typename _Alloc>
1992 _GLIBCXX20_CONSTEXPR
1993 tuple(allocator_arg_t,
const _Alloc&,
const tuple&)
noexcept { }
1996#if !(__cpp_concepts && __cpp_consteval && __cpp_conditional_explicit)
1999 template<typename _T1, typename _T2>
2005 template<
bool _Dummy,
typename _U1,
typename _U2>
2006 using _ImplicitDefaultCtor = __enable_if_t<
2007 _TupleConstraints<_Dummy, _U1, _U2>::
2008 __is_implicitly_default_constructible(),
2012 template<
bool _Dummy,
typename _U1,
typename _U2>
2013 using _ExplicitDefaultCtor = __enable_if_t<
2014 _TupleConstraints<_Dummy, _U1, _U2>::
2015 __is_explicitly_default_constructible(),
2018 template<
bool _Dummy>
2019 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
2022 template<
bool _Cond,
typename _U1,
typename _U2>
2023 using _ImplicitCtor = __enable_if_t<
2024 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
2028 template<
bool _Cond,
typename _U1,
typename _U2>
2029 using _ExplicitCtor = __enable_if_t<
2030 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
2033 template<
typename _U1,
typename _U2>
2034 static constexpr bool __assignable()
2036 return __and_<is_assignable<_T1&, _U1>,
2040 template<
typename _U1,
typename _U2>
2041 static constexpr bool __nothrow_assignable()
2043 return __and_<is_nothrow_assignable<_T1&, _U1>,
2047 template<
typename _U1,
typename _U2>
2048 static constexpr bool __nothrow_constructible()
2050 return __and_<is_nothrow_constructible<_T1, _U1>,
2054 static constexpr bool __nothrow_default_constructible()
2056 return __and_<is_nothrow_default_constructible<_T1>,
2060 template<
typename _U1>
2061 static constexpr bool __is_alloc_arg()
2065#undef __glibcxx_no_dangling_refs
2067#if __has_builtin(__reference_constructs_from_temporary) \
2068 && defined _GLIBCXX_DEBUG
2069# define __glibcxx_no_dangling_refs(_U1, _U2) \
2070 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \
2071 && !__reference_constructs_from_temporary(_T2, _U2), \
2072 "std::tuple constructor creates a dangling reference")
2074# define __glibcxx_no_dangling_refs(_U1, _U2)
2079 template<
bool _Dummy =
true,
2080 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
2083 noexcept(__nothrow_default_constructible())
2086 template<
bool _Dummy =
true,
2087 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
2090 noexcept(__nothrow_default_constructible())
2093 template<
bool _Dummy =
true,
2094 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2096 tuple(
const _T1& __a1,
const _T2& __a2)
2097 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2100 template<
bool _Dummy =
true,
2101 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2103 tuple(
const _T1& __a1,
const _T2& __a2)
2104 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
2107 template<
typename _U1,
typename _U2,
2108 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
2110 tuple(_U1&& __a1, _U2&& __a2)
2111 noexcept(__nothrow_constructible<_U1, _U2>())
2112 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2))
2113 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2115 template<
typename _U1,
typename _U2,
2116 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
2118 tuple(_U1&& __a1, _U2&& __a2)
2119 noexcept(__nothrow_constructible<_U1, _U2>())
2120 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2))
2121 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2127 template<
typename _U1,
typename _U2,
2128 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2131 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2133 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2135 template<
typename _U1,
typename _U2,
2136 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2139 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2141 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2143 template<
typename _U1,
typename _U2,
2144 _ImplicitCtor<true, _U1, _U2> =
true>
2147 noexcept(__nothrow_constructible<_U1, _U2>())
2149 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2151 template<
typename _U1,
typename _U2,
2152 _ExplicitCtor<true, _U1, _U2> =
false>
2155 noexcept(__nothrow_constructible<_U1, _U2>())
2157 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2159 template<
typename _U1,
typename _U2,
2160 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2163 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2165 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2167 template<
typename _U1,
typename _U2,
2168 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2171 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
2173 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2175 template<
typename _U1,
typename _U2,
2176 _ImplicitCtor<true, _U1, _U2> =
true>
2179 noexcept(__nothrow_constructible<_U1, _U2>())
2181 std::forward<_U2>(__in.second))
2182 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2184 template<
typename _U1,
typename _U2,
2185 _ExplicitCtor<true, _U1, _U2> =
false>
2188 noexcept(__nothrow_constructible<_U1, _U2>())
2190 std::forward<_U2>(__in.second))
2191 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2195 template<
typename _Alloc,
2196 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
2197 _GLIBCXX20_CONSTEXPR
2198 tuple(allocator_arg_t __tag,
const _Alloc& __a)
2201 template<
typename _Alloc,
bool _Dummy =
true,
2202 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
2203 _GLIBCXX20_CONSTEXPR
2204 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2205 const _T1& __a1,
const _T2& __a2)
2208 template<
typename _Alloc,
bool _Dummy =
true,
2209 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
2211 _GLIBCXX20_CONSTEXPR
2212 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2213 const _T1& __a1,
const _T2& __a2)
2216 template<
typename _Alloc,
typename _U1,
typename _U2,
2217 _ImplicitCtor<true, _U1, _U2> =
true>
2218 _GLIBCXX20_CONSTEXPR
2219 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
2220 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
2221 std::forward<_U2>(__a2))
2222 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2224 template<
typename _Alloc,
typename _U1,
typename _U2,
2225 _ExplicitCtor<true, _U1, _U2> =
false>
2227 _GLIBCXX20_CONSTEXPR
2228 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2229 _U1&& __a1, _U2&& __a2)
2230 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
2231 std::forward<_U2>(__a2))
2232 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2234 template<
typename _Alloc>
2235 _GLIBCXX20_CONSTEXPR
2236 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
2239 template<
typename _Alloc>
2240 _GLIBCXX20_CONSTEXPR
2241 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
2244 template<
typename _Alloc,
typename _U1,
typename _U2,
2245 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2246 _GLIBCXX20_CONSTEXPR
2247 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2251 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2253 template<
typename _Alloc,
typename _U1,
typename _U2,
2254 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2256 _GLIBCXX20_CONSTEXPR
2257 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2261 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2263 template<
typename _Alloc,
typename _U1,
typename _U2,
2264 _ImplicitCtor<true, _U1, _U2> =
true>
2265 _GLIBCXX20_CONSTEXPR
2268 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2270 template<
typename _Alloc,
typename _U1,
typename _U2,
2271 _ExplicitCtor<true, _U1, _U2> =
false>
2273 _GLIBCXX20_CONSTEXPR
2276 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2278 template<
typename _Alloc,
typename _U1,
typename _U2,
2279 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
2280 _GLIBCXX20_CONSTEXPR
2281 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2283 :
_Inherited(__tag, __a, __in.first, __in.second)
2284 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2286 template<
typename _Alloc,
typename _U1,
typename _U2,
2287 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
2289 _GLIBCXX20_CONSTEXPR
2290 tuple(allocator_arg_t __tag,
const _Alloc& __a,
2292 :
_Inherited(__tag, __a, __in.first, __in.second)
2293 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
2295 template<
typename _Alloc,
typename _U1,
typename _U2,
2296 _ImplicitCtor<true, _U1, _U2> =
true>
2297 _GLIBCXX20_CONSTEXPR
2299 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
2300 std::forward<_U2>(__in.second))
2301 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2303 template<
typename _Alloc,
typename _U1,
typename _U2,
2304 _ExplicitCtor<true, _U1, _U2> =
false>
2306 _GLIBCXX20_CONSTEXPR
2308 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
2309 std::forward<_U2>(__in.second))
2310 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
2314 _GLIBCXX20_CONSTEXPR
2316 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
2318 const __nonesuch&> __in)
2319 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
2321 this->_M_assign(__in);
2325 _GLIBCXX20_CONSTEXPR
2327 operator=(__conditional_t<__assignable<_T1, _T2>(),
2330 noexcept(__nothrow_assignable<_T1, _T2>())
2336 template<
typename _U1,
typename _U2>
2337 _GLIBCXX20_CONSTEXPR
2338 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
2340 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2342 this->_M_assign(__in);
2346 template<
typename _U1,
typename _U2>
2347 _GLIBCXX20_CONSTEXPR
2348 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
2350 noexcept(__nothrow_assignable<_U1, _U2>())
2356 template<
typename _U1,
typename _U2>
2357 _GLIBCXX20_CONSTEXPR
2358 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
2360 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
2362 this->_M_head(*
this) = __in.first;
2363 this->_M_tail(*this)._M_head(*
this) = __in.second;
2367 template<
typename _U1,
typename _U2>
2368 _GLIBCXX20_CONSTEXPR
2369 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
2371 noexcept(__nothrow_assignable<_U1, _U2>())
2373 this->_M_head(*
this) = std::forward<_U1>(__in.first);
2374 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__in.second);
2378 _GLIBCXX20_CONSTEXPR
2381 noexcept(__and_<__is_nothrow_swappable<_T1>,
2382 __is_nothrow_swappable<_T2>>::value)
2383 { _Inherited::_M_swap(__in); }
2388 template<
typename... _Elements>
2392#if __cplusplus >= 201703L
2393 template<
typename... _Types>
2394 inline constexpr size_t tuple_size_v<
tuple<_Types...>>
2395 =
sizeof...(_Types);
2397 template<
typename... _Types>
2398 inline constexpr size_t tuple_size_v<
const tuple<_Types...>>
2399 =
sizeof...(_Types);
2403 template<
size_t __i,
typename... _Types>
2406 static_assert(__i <
sizeof...(_Types),
"tuple index must be in range");
2408 using type =
typename _Nth_type<__i, _Types...>::type;
2411 template<
size_t __i,
typename _Head,
typename... _Tail>
2416 template<
size_t __i,
typename _Head,
typename... _Tail>
2417 constexpr const _Head&
2418 __get_helper(
const _Tuple_impl<__i, _Head, _Tail...>& __t)
noexcept
2419 {
return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
2422 template<
size_t __i,
typename... _Types>
2423 __enable_if_t<(__i >=
sizeof...(_Types))>
2424 __get_helper(
const tuple<_Types...>&) =
delete;
2427 template<
size_t __i,
typename... _Elements>
2428 constexpr __tuple_element_t<__i, tuple<_Elements...>>&
2430 {
return std::__get_helper<__i>(__t); }
2433 template<
size_t __i,
typename... _Elements>
2434 constexpr const __tuple_element_t<__i, tuple<_Elements...>>&
2436 {
return std::__get_helper<__i>(__t); }
2439 template<
size_t __i,
typename... _Elements>
2440 constexpr __tuple_element_t<__i, tuple<_Elements...>>&&
2443 typedef __tuple_element_t<__i,
tuple<_Elements...>> __element_type;
2444 return std::forward<__element_type>(std::__get_helper<__i>(__t));
2448 template<
size_t __i,
typename... _Elements>
2449 constexpr const __tuple_element_t<__i, tuple<_Elements...>>&&
2452 typedef __tuple_element_t<__i,
tuple<_Elements...>> __element_type;
2453 return std::forward<const __element_type>(std::__get_helper<__i>(__t));
2458 template<
size_t __i,
typename... _Elements>
2459 constexpr __enable_if_t<(__i >=
sizeof...(_Elements))>
2460 get(
const tuple<_Elements...>&) =
delete;
2463#ifdef __cpp_lib_tuples_by_type
2465 template <typename _Tp, typename... _Types>
2467 get(tuple<_Types...>& __t)
noexcept
2469 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
2470 static_assert(__idx <
sizeof...(_Types),
2471 "the type T in std::get<T> must occur exactly once in the tuple");
2472 return std::__get_helper<__idx>(__t);
2476 template <
typename _Tp,
typename... _Types>
2478 get(tuple<_Types...>&& __t)
noexcept
2480 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
2481 static_assert(__idx <
sizeof...(_Types),
2482 "the type T in std::get<T> must occur exactly once in the tuple");
2483 return std::forward<_Tp>(std::__get_helper<__idx>(__t));
2487 template <
typename _Tp,
typename... _Types>
2488 constexpr const _Tp&
2489 get(
const tuple<_Types...>& __t)
noexcept
2491 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
2492 static_assert(__idx <
sizeof...(_Types),
2493 "the type T in std::get<T> must occur exactly once in the tuple");
2494 return std::__get_helper<__idx>(__t);
2499 template <
typename _Tp,
typename... _Types>
2500 constexpr const _Tp&&
2501 get(
const tuple<_Types...>&& __t)
noexcept
2503 constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
2504 static_assert(__idx <
sizeof...(_Types),
2505 "the type T in std::get<T> must occur exactly once in the tuple");
2506 return std::forward<const _Tp>(std::__get_helper<__idx>(__t));
2511 template<
typename _Tp,
typename _Up,
size_t __i,
size_t __size>
2512 struct __tuple_compare
2514 static constexpr bool
2515 __eq(
const _Tp& __t,
const _Up& __u)
2517 return bool(std::get<__i>(__t) == std::get<__i>(__u))
2518 && __tuple_compare<_Tp, _Up, __i + 1, __size>::__eq(__t, __u);
2521 static constexpr bool
2522 __less(
const _Tp& __t,
const _Up& __u)
2524 return bool(std::get<__i>(__t) < std::get<__i>(__u))
2525 || (!bool(std::get<__i>(__u) < std::get<__i>(__t))
2526 && __tuple_compare<_Tp, _Up, __i + 1, __size>::__less(__t, __u));
2530 template<
typename _Tp,
typename _Up,
size_t __size>
2531 struct __tuple_compare<_Tp, _Up, __size, __size>
2533 static constexpr bool
2534 __eq(
const _Tp&,
const _Up&) {
return true; }
2536 static constexpr bool
2537 __less(
const _Tp&,
const _Up&) {
return false; }
2540 template<
typename... _TElements,
typename... _UElements>
2542 operator==(
const tuple<_TElements...>& __t,
2543 const tuple<_UElements...>& __u)
2545 static_assert(
sizeof...(_TElements) ==
sizeof...(_UElements),
2546 "tuple objects can only be compared if they have equal sizes.");
2547 using __compare = __tuple_compare<tuple<_TElements...>,
2548 tuple<_UElements...>,
2549 0,
sizeof...(_TElements)>;
2550 return __compare::__eq(__t, __u);
2553#if __cpp_lib_three_way_comparison
2554 template<
typename _Cat,
typename _Tp,
typename _Up>
2556 __tuple_cmp(
const _Tp&,
const _Up&, index_sequence<>)
2557 {
return _Cat::equivalent; }
2559 template<
typename _Cat,
typename _Tp,
typename _Up,
2560 size_t _Idx0,
size_t... _Idxs>
2562 __tuple_cmp(
const _Tp& __t,
const _Up& __u,
2563 index_sequence<_Idx0, _Idxs...>)
2566 = __detail::__synth3way(std::get<_Idx0>(__t), std::get<_Idx0>(__u));
2569 return std::__tuple_cmp<_Cat>(__t, __u, index_sequence<_Idxs...>());
2572 template<
typename... _Tps,
typename... _Ups>
2574 common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...>
2575 operator<=>(
const tuple<_Tps...>& __t,
const tuple<_Ups...>& __u)
2578 = common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...>;
2579 return std::__tuple_cmp<_Cat>(__t, __u, index_sequence_for<_Tps...>());
2582 template<
typename... _TElements,
typename... _UElements>
2584 operator<(
const tuple<_TElements...>& __t,
2585 const tuple<_UElements...>& __u)
2587 static_assert(
sizeof...(_TElements) ==
sizeof...(_UElements),
2588 "tuple objects can only be compared if they have equal sizes.");
2589 using __compare = __tuple_compare<tuple<_TElements...>,
2590 tuple<_UElements...>,
2591 0,
sizeof...(_TElements)>;
2592 return __compare::__less(__t, __u);
2595 template<
typename... _TElements,
typename... _UElements>
2597 operator!=(
const tuple<_TElements...>& __t,
2598 const tuple<_UElements...>& __u)
2599 {
return !(__t == __u); }
2601 template<
typename... _TElements,
typename... _UElements>
2603 operator>(
const tuple<_TElements...>& __t,
2604 const tuple<_UElements...>& __u)
2605 {
return __u < __t; }
2607 template<
typename... _TElements,
typename... _UElements>
2610 const tuple<_UElements...>& __u)
2611 {
return !(__u < __t); }
2613 template<
typename... _TElements,
typename... _UElements>
2616 const tuple<_UElements...>& __u)
2617 {
return !(__t < __u); }
2622 template<
typename... _Elements>
2623 constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
2628 return __result_type(std::forward<_Elements>(__args)...);
2634 template<
typename... _Elements>
2635 constexpr tuple<_Elements&&...>
2637 {
return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
2640 template<
size_t,
typename,
typename,
size_t>
2641 struct __make_tuple_impl;
2643 template<
size_t _Idx,
typename _Tuple,
typename... _Tp,
size_t _Nm>
2644 struct __make_tuple_impl<_Idx, tuple<_Tp...>, _Tuple, _Nm>
2645 : __make_tuple_impl<_Idx + 1,
2646 tuple<_Tp..., __tuple_element_t<_Idx, _Tuple>>,
2650 template<
size_t _Nm,
typename _Tuple,
typename... _Tp>
2651 struct __make_tuple_impl<_Nm, tuple<_Tp...>, _Tuple, _Nm>
2653 typedef tuple<_Tp...> __type;
2656 template<
typename _Tuple>
2657 struct __do_make_tuple
2658 : __make_tuple_impl<0, tuple<>, _Tuple, tuple_size<_Tuple>::value>
2662 template<
typename _Tuple>
2664 :
public __do_make_tuple<__remove_cvref_t<_Tuple>>
2668 template<
typename...>
2669 struct __combine_tuples;
2672 struct __combine_tuples<>
2674 typedef tuple<> __type;
2677 template<
typename... _Ts>
2678 struct __combine_tuples<tuple<_Ts...>>
2680 typedef tuple<_Ts...> __type;
2683 template<
typename... _T1s,
typename... _T2s,
typename... _Rem>
2684 struct __combine_tuples<tuple<_T1s...>, tuple<_T2s...>, _Rem...>
2686 typedef typename __combine_tuples<tuple<_T1s..., _T2s...>,
2687 _Rem...>::__type __type;
2691 template<
typename... _Tpls>
2692 struct __tuple_cat_result
2694 typedef typename __combine_tuples
2695 <
typename __make_tuple<_Tpls>::__type...>::__type __type;
2700 template<
typename...>
2701 struct __make_1st_indices;
2704 struct __make_1st_indices<>
2706 typedef _Index_tuple<> __type;
2709 template<
typename _Tp,
typename... _Tpls>
2710 struct __make_1st_indices<_Tp, _Tpls...>
2712 typedef typename _Build_index_tuple<tuple_size<
2713 typename remove_reference<_Tp>::type>::value>::__type __type;
2719 template<
typename _Ret,
typename _Indices,
typename... _Tpls>
2720 struct __tuple_concater;
2722 template<
typename _Ret,
size_t... _Is,
typename _Tp,
typename... _Tpls>
2723 struct __tuple_concater<_Ret, _Index_tuple<_Is...>, _Tp, _Tpls...>
2725 template<
typename... _Us>
2726 static constexpr _Ret
2727 _S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us)
2729 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
2730 typedef __tuple_concater<_Ret, __idx, _Tpls...> __next;
2731 return __next::_S_do(std::forward<_Tpls>(__tps)...,
2732 std::forward<_Us>(__us)...,
2733 std::get<_Is>(std::forward<_Tp>(__tp))...);
2737 template<
typename _Ret>
2738 struct __tuple_concater<_Ret, _Index_tuple<>>
2740 template<
typename... _Us>
2741 static constexpr _Ret
2742 _S_do(_Us&&... __us)
2744 return _Ret(std::forward<_Us>(__us)...);
2748 template<
typename... _Tps>
2749 struct __is_tuple_like_impl<tuple<_Tps...>> :
true_type
2754#if __cpp_lib_tuple_like
2755 template<__tuple_like... _Tpls>
2757 template<
typename... _Tpls,
typename =
typename
2758 enable_if<__and_<__is_tuple_like<_Tpls>...>::value>::type>
2762 ->
typename __tuple_cat_result<_Tpls...>::__type
2764 typedef typename __tuple_cat_result<_Tpls...>::__type __ret;
2765 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
2766 typedef __tuple_concater<__ret, __idx, _Tpls...> __concater;
2767 return __concater::_S_do(std::forward<_Tpls>(__tpls)...);
2773 template<
typename... _Elements>
2774 constexpr tuple<_Elements&...>
2775 tie(_Elements&... __args)
noexcept
2776 {
return tuple<_Elements&...>(__args...); }
2779 template<
typename... _Elements>
2780 _GLIBCXX20_CONSTEXPR
2782#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
2784 typename enable_if<__and_<__is_swappable<_Elements>...>::value
2790 noexcept(
noexcept(__x.swap(__y)))
2793#if __cpp_lib_ranges_zip
2794 template<
typename... _Elements>
2795 requires (is_swappable_v<const _Elements> && ...)
2797 swap(
const tuple<_Elements...>& __x,
const tuple<_Elements...>& __y)
2798 noexcept(
noexcept(__x.swap(__y)))
2802#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
2804 template<typename... _Elements>
2805 _GLIBCXX20_CONSTEXPR
2806 typename enable_if<!__and_<__is_swappable<_Elements>...>::value>::type
2807 swap(tuple<_Elements...>&, tuple<_Elements...>&) =
delete;
2814 struct _Swallow_assign
2817 _GLIBCXX14_CONSTEXPR
const _Swallow_assign&
2818 operator=(
const _Tp&)
const
2839 _GLIBCXX17_INLINE
constexpr _Swallow_assign
ignore{};
2842 template<
typename... _Types,
typename _Alloc>
2854 template<
class _T1,
class _T2>
2855 template<
typename... _Args1,
typename... _Args2>
2856 _GLIBCXX20_CONSTEXPR
2861 :
pair(__first, __second,
2862 typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
2863 typename _Build_index_tuple<sizeof...(_Args2)>::__type())