29 #ifndef _GLIBCXX_TUPLE
30 #define _GLIBCXX_TUPLE 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
39 #include <bits/uses_allocator.h>
42 #if __cplusplus > 201703L
44 # define __cpp_lib_constexpr_tuple 201811L
47 namespace std _GLIBCXX_VISIBILITY(default)
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
56 template<
typename... _Elements>
59 template<
typename _Tp>
60 struct __is_empty_non_tuple : is_empty<_Tp> { };
63 template<
typename _El0,
typename... _El>
64 struct __is_empty_non_tuple<tuple<_El0, _El...>> :
false_type { };
67 template<
typename _Tp>
68 using __empty_not_final
70 __is_empty_non_tuple<_Tp>>;
72 template<
size_t _Idx,
typename _Head,
73 bool = __empty_not_final<_Head>::value>
76 #if __has_cpp_attribute(__no_unique_address__)
77 template<
size_t _Idx,
typename _Head>
78 struct _Head_base<_Idx, _Head, true>
80 constexpr _Head_base()
83 constexpr _Head_base(
const _Head& __h)
84 : _M_head_impl(__h) { }
86 constexpr _Head_base(
const _Head_base&) =
default;
87 constexpr _Head_base(_Head_base&&) =
default;
89 template<
typename _UHead>
90 constexpr _Head_base(_UHead&& __h)
94 _Head_base(allocator_arg_t, __uses_alloc0)
97 template<
typename _Alloc>
99 _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a)
100 : _M_head_impl(allocator_arg, *__a._M_a) { }
102 template<
typename _Alloc>
104 _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a)
105 : _M_head_impl(*__a._M_a) { }
107 template<
typename _UHead>
109 _Head_base(__uses_alloc0, _UHead&& __uhead)
110 : _M_head_impl(
std::
forward<_UHead>(__uhead)) { }
112 template<
typename _Alloc,
typename _UHead>
114 _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
115 : _M_head_impl(allocator_arg, *__a._M_a,
std::
forward<_UHead>(__uhead))
118 template<
typename _Alloc,
typename _UHead>
120 _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
121 : _M_head_impl(
std::
forward<_UHead>(__uhead), *__a._M_a) { }
123 static constexpr _Head&
124 _M_head(_Head_base& __b) noexcept {
return __b._M_head_impl; }
126 static constexpr
const _Head&
127 _M_head(
const _Head_base& __b) noexcept {
return __b._M_head_impl; }
129 [[__no_unique_address__]] _Head _M_head_impl;
132 template<
size_t _Idx,
typename _Head>
133 struct _Head_base<_Idx, _Head, true>
136 constexpr _Head_base()
139 constexpr _Head_base(
const _Head& __h)
142 constexpr _Head_base(
const _Head_base&) =
default;
143 constexpr _Head_base(_Head_base&&) =
default;
145 template<
typename _UHead>
146 constexpr _Head_base(_UHead&& __h)
150 _Head_base(allocator_arg_t, __uses_alloc0)
153 template<
typename _Alloc>
155 _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a)
156 : _Head(allocator_arg, *__a._M_a) { }
158 template<
typename _Alloc>
160 _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a)
161 : _Head(*__a._M_a) { }
163 template<
typename _UHead>
165 _Head_base(__uses_alloc0, _UHead&& __uhead)
168 template<
typename _Alloc,
typename _UHead>
170 _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
171 : _Head(allocator_arg, *__a._M_a,
std::
forward<_UHead>(__uhead)) { }
173 template<
typename _Alloc,
typename _UHead>
175 _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
176 : _Head(
std::
forward<_UHead>(__uhead), *__a._M_a) { }
178 static constexpr _Head&
179 _M_head(_Head_base& __b) noexcept {
return __b; }
181 static constexpr
const _Head&
182 _M_head(
const _Head_base& __b) noexcept {
return __b; }
186 template<
size_t _Idx,
typename _Head>
187 struct _Head_base<_Idx, _Head, false>
189 constexpr _Head_base()
192 constexpr _Head_base(
const _Head& __h)
193 : _M_head_impl(__h) { }
195 constexpr _Head_base(
const _Head_base&) =
default;
196 constexpr _Head_base(_Head_base&&) =
default;
198 template<
typename _UHead>
199 constexpr _Head_base(_UHead&& __h)
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>
717 template<
typename _Dummy = void,
718 _ExplicitDefaultCtor<is_void<_Dummy>::value> =
false>
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,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
805 _ImplicitCtor<_NotEmpty,
const _Elements&...> =
true>
807 tuple(allocator_arg_t __tag,
const _Alloc& __a,
808 const _Elements&... __elements)
811 template<
typename _Alloc,
bool _NotEmpty = (
sizeof...(_Elements) >= 1),
812 _ExplicitCtor<_NotEmpty,
const _Elements&...> =
false>
815 tuple(allocator_arg_t __tag,
const _Alloc& __a,
816 const _Elements&... __elements)
819 template<
typename _Alloc,
typename... _UElements,
820 bool _Valid = __valid_args<_UElements...>(),
821 _ImplicitCtor<_Valid, _UElements...> =
true>
823 tuple(allocator_arg_t __tag,
const _Alloc& __a,
824 _UElements&&... __elements)
825 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
828 template<
typename _Alloc,
typename... _UElements,
829 bool _Valid = __valid_args<_UElements...>(),
830 _ExplicitCtor<_Valid, _UElements...> =
false>
833 tuple(allocator_arg_t __tag,
const _Alloc& __a,
834 _UElements&&... __elements)
835 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
838 template<
typename _Alloc>
840 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
843 template<
typename _Alloc>
845 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
848 template<
typename _Alloc,
typename... _UElements,
849 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
851 _ImplicitCtor<_Valid,
const _UElements&...> =
true>
853 tuple(allocator_arg_t __tag,
const _Alloc& __a,
856 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
859 template<
typename _Alloc,
typename... _UElements,
860 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
862 _ExplicitCtor<_Valid,
const _UElements&...> =
false>
865 tuple(allocator_arg_t __tag,
const _Alloc& __a,
868 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
871 template<
typename _Alloc,
typename... _UElements,
872 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
874 _ImplicitCtor<_Valid, _UElements...> =
true>
876 tuple(allocator_arg_t __tag,
const _Alloc& __a,
879 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
882 template<
typename _Alloc,
typename... _UElements,
883 bool _Valid = (
sizeof...(_Elements) ==
sizeof...(_UElements))
885 _ExplicitCtor<_Valid, _UElements...> =
false>
888 tuple(allocator_arg_t __tag,
const _Alloc& __a,
891 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
898 operator=(__conditional_t<__assignable<const _Elements&...>(),
900 const __nonesuch&> __in)
901 noexcept(__nothrow_assignable<const _Elements&...>())
903 this->_M_assign(__in);
909 operator=(__conditional_t<__assignable<_Elements...>(),
912 noexcept(__nothrow_assignable<_Elements...>())
918 template<
typename... _UElements>
920 __enable_if_t<__assignable<
const _UElements&...>(),
tuple&>
922 noexcept(__nothrow_assignable<const _UElements&...>())
924 this->_M_assign(__in);
928 template<
typename... _UElements>
930 __enable_if_t<__assignable<_UElements...>(),
tuple&>
932 noexcept(__nothrow_assignable<_UElements...>())
942 noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value)
943 { _Inherited::_M_swap(__in); }
946 #if __cpp_deduction_guides >= 201606
947 template<
typename... _UTypes>
949 template<
typename _T1,
typename _T2>
951 template<
typename _Alloc,
typename... _UTypes>
952 tuple(allocator_arg_t, _Alloc, _UTypes...) ->
tuple<_UTypes...>;
953 template<
typename _Alloc,
typename _T1,
typename _T2>
955 template<
typename _Alloc,
typename... _UTypes>
965 void swap(
tuple&) noexcept { }
970 template<
typename _Alloc>
972 tuple(allocator_arg_t,
const _Alloc&) noexcept { }
973 template<
typename _Alloc>
975 tuple(allocator_arg_t,
const _Alloc&,
const tuple&) noexcept { }
980 template<
typename _T1,
typename _T2>
986 template<
bool _Dummy,
typename _U1,
typename _U2>
987 using _ImplicitDefaultCtor = __enable_if_t<
988 _TupleConstraints<_Dummy, _U1, _U2>::
989 __is_implicitly_default_constructible(),
993 template<
bool _Dummy,
typename _U1,
typename _U2>
994 using _ExplicitDefaultCtor = __enable_if_t<
995 _TupleConstraints<_Dummy, _U1, _U2>::
996 __is_explicitly_default_constructible(),
999 template<
bool _Dummy>
1000 using _TCC = _TupleConstraints<_Dummy, _T1, _T2>;
1003 template<
bool _Cond,
typename _U1,
typename _U2>
1004 using _ImplicitCtor = __enable_if_t<
1005 _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(),
1009 template<
bool _Cond,
typename _U1,
typename _U2>
1010 using _ExplicitCtor = __enable_if_t<
1011 _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(),
1014 template<
typename _U1,
typename _U2>
1015 static constexpr
bool __assignable()
1017 return __and_<is_assignable<_T1&, _U1>,
1021 template<
typename _U1,
typename _U2>
1022 static constexpr
bool __nothrow_assignable()
1024 return __and_<is_nothrow_assignable<_T1&, _U1>,
1028 template<
typename _U1,
typename _U2>
1029 static constexpr
bool __nothrow_constructible()
1031 return __and_<is_nothrow_constructible<_T1, _U1>,
1035 static constexpr
bool __nothrow_default_constructible()
1037 return __and_<is_nothrow_default_constructible<_T1>,
1041 template<
typename _U1>
1042 static constexpr
bool __is_alloc_arg()
1046 template<
bool _Dummy =
true,
1047 _ImplicitDefaultCtor<_Dummy, _T1, _T2> =
true>
1050 noexcept(__nothrow_default_constructible())
1053 template<
bool _Dummy =
true,
1054 _ExplicitDefaultCtor<_Dummy, _T1, _T2> =
false>
1057 noexcept(__nothrow_default_constructible())
1060 template<
bool _Dummy =
true,
1061 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
1063 tuple(
const _T1& __a1,
const _T2& __a2)
1064 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1067 template<
bool _Dummy =
true,
1068 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
1070 tuple(
const _T1& __a1,
const _T2& __a2)
1071 noexcept(__nothrow_constructible<const _T1&, const _T2&>())
1074 template<
typename _U1,
typename _U2,
1075 _ImplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
true>
1077 tuple(_U1&& __a1, _U2&& __a2)
1078 noexcept(__nothrow_constructible<_U1, _U2>())
1079 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
1081 template<
typename _U1,
typename _U2,
1082 _ExplicitCtor<!__is_alloc_arg<_U1>(), _U1, _U2> =
false>
1084 tuple(_U1&& __a1, _U2&& __a2)
1085 noexcept(__nothrow_constructible<_U1, _U2>())
1086 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
1092 template<
typename _U1,
typename _U2,
1093 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1096 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1099 template<
typename _U1,
typename _U2,
1100 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1103 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1106 template<
typename _U1,
typename _U2,
1107 _ImplicitCtor<true, _U1, _U2> =
true>
1110 noexcept(__nothrow_constructible<_U1, _U2>())
1113 template<
typename _U1,
typename _U2,
1114 _ExplicitCtor<true, _U1, _U2> =
false>
1117 noexcept(__nothrow_constructible<_U1, _U2>())
1120 template<
typename _U1,
typename _U2,
1121 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1124 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1127 template<
typename _U1,
typename _U2,
1128 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1131 noexcept(__nothrow_constructible<const _U1&, const _U2&>())
1134 template<
typename _U1,
typename _U2,
1135 _ImplicitCtor<true, _U1, _U2> =
true>
1138 noexcept(__nothrow_constructible<_U1, _U2>())
1140 std::forward<_U2>(__in.second)) { }
1142 template<
typename _U1,
typename _U2,
1143 _ExplicitCtor<true, _U1, _U2> =
false>
1146 noexcept(__nothrow_constructible<_U1, _U2>())
1148 std::forward<_U2>(__in.second)) { }
1152 template<
typename _Alloc,
1153 _ImplicitDefaultCtor<is_object<_Alloc>::value, _T1, _T2> =
true>
1154 _GLIBCXX20_CONSTEXPR
1155 tuple(allocator_arg_t __tag,
const _Alloc& __a)
1158 template<
typename _Alloc,
bool _Dummy =
true,
1159 _ImplicitCtor<_Dummy, const _T1&, const _T2&> =
true>
1160 _GLIBCXX20_CONSTEXPR
1161 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1162 const _T1& __a1,
const _T2& __a2)
1165 template<
typename _Alloc,
bool _Dummy =
true,
1166 _ExplicitCtor<_Dummy, const _T1&, const _T2&> =
false>
1168 _GLIBCXX20_CONSTEXPR
1169 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1170 const _T1& __a1,
const _T2& __a2)
1173 template<
typename _Alloc,
typename _U1,
typename _U2,
1174 _ImplicitCtor<true, _U1, _U2> =
true>
1175 _GLIBCXX20_CONSTEXPR
1176 tuple(allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
1177 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
1178 std::forward<_U2>(__a2)) { }
1180 template<
typename _Alloc,
typename _U1,
typename _U2,
1181 _ExplicitCtor<true, _U1, _U2> =
false>
1183 _GLIBCXX20_CONSTEXPR
1184 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1185 _U1&& __a1, _U2&& __a2)
1186 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
1187 std::forward<_U2>(__a2)) { }
1189 template<
typename _Alloc>
1190 _GLIBCXX20_CONSTEXPR
1191 tuple(allocator_arg_t __tag,
const _Alloc& __a,
const tuple& __in)
1194 template<
typename _Alloc>
1195 _GLIBCXX20_CONSTEXPR
1196 tuple(allocator_arg_t __tag,
const _Alloc& __a,
tuple&& __in)
1199 template<
typename _Alloc,
typename _U1,
typename _U2,
1200 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1201 _GLIBCXX20_CONSTEXPR
1202 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1208 template<
typename _Alloc,
typename _U1,
typename _U2,
1209 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1211 _GLIBCXX20_CONSTEXPR
1212 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1218 template<
typename _Alloc,
typename _U1,
typename _U2,
1219 _ImplicitCtor<true, _U1, _U2> =
true>
1220 _GLIBCXX20_CONSTEXPR
1225 template<
typename _Alloc,
typename _U1,
typename _U2,
1226 _ExplicitCtor<true, _U1, _U2> =
false>
1228 _GLIBCXX20_CONSTEXPR
1233 template<
typename _Alloc,
typename _U1,
typename _U2,
1234 _ImplicitCtor<true, const _U1&, const _U2&> =
true>
1235 _GLIBCXX20_CONSTEXPR
1236 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1238 :
_Inherited(__tag, __a, __in.first, __in.second) { }
1240 template<
typename _Alloc,
typename _U1,
typename _U2,
1241 _ExplicitCtor<true, const _U1&, const _U2&> =
false>
1243 _GLIBCXX20_CONSTEXPR
1244 tuple(allocator_arg_t __tag,
const _Alloc& __a,
1246 :
_Inherited(__tag, __a, __in.first, __in.second) { }
1248 template<
typename _Alloc,
typename _U1,
typename _U2,
1249 _ImplicitCtor<true, _U1, _U2> =
true>
1250 _GLIBCXX20_CONSTEXPR
1252 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
1253 std::forward<_U2>(__in.second)) { }
1255 template<
typename _Alloc,
typename _U1,
typename _U2,
1256 _ExplicitCtor<true, _U1, _U2> =
false>
1258 _GLIBCXX20_CONSTEXPR
1260 :
_Inherited(__tag, __a, std::forward<_U1>(__in.first),
1261 std::forward<_U2>(__in.second)) { }
1265 _GLIBCXX20_CONSTEXPR
1267 operator=(__conditional_t<__assignable<const _T1&, const _T2&>(),
1269 const __nonesuch&> __in)
1270 noexcept(__nothrow_assignable<const _T1&, const _T2&>())
1272 this->_M_assign(__in);
1276 _GLIBCXX20_CONSTEXPR
1278 operator=(__conditional_t<__assignable<_T1, _T2>(),
1281 noexcept(__nothrow_assignable<_T1, _T2>())
1287 template<
typename _U1,
typename _U2>
1288 _GLIBCXX20_CONSTEXPR
1289 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
1291 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1293 this->_M_assign(__in);
1297 template<
typename _U1,
typename _U2>
1298 _GLIBCXX20_CONSTEXPR
1299 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
1301 noexcept(__nothrow_assignable<_U1, _U2>())
1307 template<
typename _U1,
typename _U2>
1308 _GLIBCXX20_CONSTEXPR
1309 __enable_if_t<__assignable<const _U1&, const _U2&>(),
tuple&>
1311 noexcept(__nothrow_assignable<const _U1&, const _U2&>())
1313 this->_M_head(*
this) = __in.first;
1314 this->_M_tail(*this)._M_head(*
this) = __in.second;
1318 template<
typename _U1,
typename _U2>
1319 _GLIBCXX20_CONSTEXPR
1320 __enable_if_t<__assignable<_U1, _U2>(),
tuple&>
1322 noexcept(__nothrow_assignable<_U1, _U2>())
1324 this->_M_head(*
this) = std::forward<_U1>(__in.first);
1325 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__in.second);
1329 _GLIBCXX20_CONSTEXPR
1332 noexcept(__and_<__is_nothrow_swappable<_T1>,
1333 __is_nothrow_swappable<_T2>>::value)
1334 { _Inherited::_M_swap(__in); }
1339 template<
typename... _Elements>
1343 #if __cplusplus >= 201703L
1344 template<
typename... _Types>
1345 inline constexpr
size_t tuple_size_v<
tuple<_Types...>>
1346 =
sizeof...(_Types);
1348 template<
typename... _Types>
1349 inline constexpr
size_t tuple_size_v<
const tuple<_Types...>>
1350 =
sizeof...(_Types);
1354 template<
size_t __i,
typename... _Types>
1357 static_assert(__i <
sizeof...(_Types),
"tuple index must be in range");
1359 using type =
typename _Nth_type<__i, _Types...>::type;
1362 template<
size_t __i,
typename _Head,
typename... _Tail>
1367 template<
size_t __i,
typename _Head,
typename... _Tail>
1368 constexpr
const _Head&
1369 __get_helper(
const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
1370 {
return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
1373 template<
size_t __i,
typename... _Types>
1374 __enable_if_t<(__i >=
sizeof...(_Types))>
1375 __get_helper(
const tuple<_Types...>&) =
delete;
1378 template<
size_t __i,
typename... _Elements>
1379 constexpr __tuple_element_t<__i, tuple<_Elements...>>&
1381 {
return std::__get_helper<__i>(__t); }
1384 template<
size_t __i,
typename... _Elements>
1385 constexpr
const __tuple_element_t<__i, tuple<_Elements...>>&
1387 {
return std::__get_helper<__i>(__t); }
1390 template<
size_t __i,
typename... _Elements>
1391 constexpr __tuple_element_t<__i, tuple<_Elements...>>&&
1394 typedef __tuple_element_t<__i,
tuple<_Elements...>> __element_type;
1395 return std::forward<__element_type>(std::__get_helper<__i>(__t));
1399 template<
size_t __i,
typename... _Elements>
1400 constexpr
const __tuple_element_t<__i, tuple<_Elements...>>&&
1403 typedef __tuple_element_t<__i,
tuple<_Elements...>> __element_type;
1404 return std::forward<const __element_type>(std::__get_helper<__i>(__t));
1409 template<
size_t __i,
typename... _Elements>
1410 constexpr __enable_if_t<(__i >=
sizeof...(_Elements))>
1411 get(
const tuple<_Elements...>&) =
delete;
1414 #if __cplusplus >= 201402L
1416 #define __cpp_lib_tuples_by_type 201304L
1419 template <
typename _Tp,
typename... _Types>
1423 constexpr
size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1424 static_assert(__idx <
sizeof...(_Types),
1425 "the type T in std::get<T> must occur exactly once in the tuple");
1426 return std::__get_helper<__idx>(__t);
1430 template <
typename _Tp,
typename... _Types>
1434 constexpr
size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1435 static_assert(__idx <
sizeof...(_Types),
1436 "the type T in std::get<T> must occur exactly once in the tuple");
1437 return std::forward<_Tp>(std::__get_helper<__idx>(__t));
1441 template <
typename _Tp,
typename... _Types>
1442 constexpr
const _Tp&
1445 constexpr
size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1446 static_assert(__idx <
sizeof...(_Types),
1447 "the type T in std::get<T> must occur exactly once in the tuple");
1448 return std::__get_helper<__idx>(__t);
1453 template <
typename _Tp,
typename... _Types>
1454 constexpr
const _Tp&&
1457 constexpr
size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>();
1458 static_assert(__idx <
sizeof...(_Types),
1459 "the type T in std::get<T> must occur exactly once in the tuple");
1460 return std::forward<const _Tp>(std::__get_helper<__idx>(__t));
1465 template<
typename _Tp,
typename _Up,
size_t __i,
size_t __size>
1466 struct __tuple_compare
1468 static constexpr
bool
1469 __eq(
const _Tp& __t,
const _Up& __u)
1471 return bool(std::get<__i>(__t) == std::get<__i>(__u))
1472 && __tuple_compare<_Tp, _Up, __i + 1, __size>::__eq(__t, __u);
1475 static constexpr
bool
1476 __less(
const _Tp& __t,
const _Up& __u)
1478 return bool(std::get<__i>(__t) < std::get<__i>(__u))
1479 || (!bool(std::get<__i>(__u) < std::get<__i>(__t))
1480 && __tuple_compare<_Tp, _Up, __i + 1, __size>::__less(__t, __u));
1484 template<
typename _Tp,
typename _Up,
size_t __size>
1485 struct __tuple_compare<_Tp, _Up, __size, __size>
1487 static constexpr
bool
1488 __eq(
const _Tp&,
const _Up&) {
return true; }
1490 static constexpr
bool
1491 __less(
const _Tp&,
const _Up&) {
return false; }
1494 template<
typename... _TElements,
typename... _UElements>
1496 operator==(
const tuple<_TElements...>& __t,
1497 const tuple<_UElements...>& __u)
1499 static_assert(
sizeof...(_TElements) ==
sizeof...(_UElements),
1500 "tuple objects can only be compared if they have equal sizes.");
1501 using __compare = __tuple_compare<tuple<_TElements...>,
1502 tuple<_UElements...>,
1503 0,
sizeof...(_TElements)>;
1504 return __compare::__eq(__t, __u);
1507 #if __cpp_lib_three_way_comparison
1508 template<
typename _Cat,
typename _Tp,
typename _Up>
1510 __tuple_cmp(
const _Tp&,
const _Up&, index_sequence<>)
1511 {
return _Cat::equivalent; }
1513 template<
typename _Cat,
typename _Tp,
typename _Up,
1514 size_t _Idx0,
size_t... _Idxs>
1516 __tuple_cmp(
const _Tp& __t,
const _Up& __u,
1517 index_sequence<_Idx0, _Idxs...>)
1520 = __detail::__synth3way(std::get<_Idx0>(__t), std::get<_Idx0>(__u));
1523 return std::__tuple_cmp<_Cat>(__t, __u, index_sequence<_Idxs...>());
1526 template<
typename... _Tps,
typename... _Ups>
1528 common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...>
1529 operator<=>(
const tuple<_Tps...>& __t,
const tuple<_Ups...>& __u)
1532 = common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...>;
1533 return std::__tuple_cmp<_Cat>(__t, __u, index_sequence_for<_Tps...>());
1536 template<
typename... _TElements,
typename... _UElements>
1538 operator<(
const tuple<_TElements...>& __t,
1539 const tuple<_UElements...>& __u)
1541 static_assert(
sizeof...(_TElements) ==
sizeof...(_UElements),
1542 "tuple objects can only be compared if they have equal sizes.");
1543 using __compare = __tuple_compare<tuple<_TElements...>,
1544 tuple<_UElements...>,
1545 0,
sizeof...(_TElements)>;
1546 return __compare::__less(__t, __u);
1549 template<
typename... _TElements,
typename... _UElements>
1551 operator!=(
const tuple<_TElements...>& __t,
1552 const tuple<_UElements...>& __u)
1553 {
return !(__t == __u); }
1555 template<
typename... _TElements,
typename... _UElements>
1557 operator>(
const tuple<_TElements...>& __t,
1558 const tuple<_UElements...>& __u)
1559 {
return __u < __t; }
1561 template<
typename... _TElements,
typename... _UElements>
1563 operator<=(
const tuple<_TElements...>& __t,
1564 const tuple<_UElements...>& __u)
1565 {
return !(__u < __t); }
1567 template<
typename... _TElements,
typename... _UElements>
1569 operator>=(
const tuple<_TElements...>& __t,
1570 const tuple<_UElements...>& __u)
1571 {
return !(__t < __u); }
1575 template<
typename... _Elements>
1576 constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
1577 make_tuple(_Elements&&... __args)
1579 typedef tuple<typename __decay_and_strip<_Elements>::__type...>
1581 return __result_type(std::forward<_Elements>(__args)...);
1587 template<
typename... _Elements>
1588 constexpr tuple<_Elements&&...>
1590 {
return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
1595 template<
typename _Tp,
size_t _Nm>
struct array;
1597 template<
size_t _Int,
typename _Tp,
size_t _Nm>
1599 get(array<_Tp, _Nm>&) noexcept;
1601 template<
size_t _Int,
typename _Tp,
size_t _Nm>
1603 get(array<_Tp, _Nm>&&) noexcept;
1605 template<
size_t _Int, typename _Tp,
size_t _Nm>
1606 constexpr const _Tp&
1607 get(const array<_Tp, _Nm>&) noexcept;
1609 template<
size_t _Int, typename _Tp,
size_t _Nm>
1610 constexpr const _Tp&&
1611 get(const array<_Tp, _Nm>&&) noexcept;
1614 template<
size_t, typename, typename,
size_t>
1615 struct __make_tuple_impl;
1617 template<
size_t _Idx, typename _Tuple, typename... _Tp,
size_t _Nm>
1618 struct __make_tuple_impl<_Idx, tuple<_Tp...>, _Tuple, _Nm>
1619 : __make_tuple_impl<_Idx + 1,
1620 tuple<_Tp..., __tuple_element_t<_Idx, _Tuple>>,
1624 template<
size_t _Nm,
typename _Tuple,
typename... _Tp>
1625 struct __make_tuple_impl<_Nm, tuple<_Tp...>, _Tuple, _Nm>
1627 typedef tuple<_Tp...> __type;
1630 template<
typename _Tuple>
1631 struct __do_make_tuple
1632 : __make_tuple_impl<0, tuple<>, _Tuple, tuple_size<_Tuple>::value>
1636 template<
typename _Tuple>
1638 :
public __do_make_tuple<__remove_cvref_t<_Tuple>>
1642 template<
typename...>
1643 struct __combine_tuples;
1646 struct __combine_tuples<>
1648 typedef tuple<> __type;
1651 template<
typename... _Ts>
1652 struct __combine_tuples<tuple<_Ts...>>
1654 typedef tuple<_Ts...> __type;
1657 template<
typename... _T1s,
typename... _T2s,
typename... _Rem>
1658 struct __combine_tuples<tuple<_T1s...>, tuple<_T2s...>, _Rem...>
1660 typedef typename __combine_tuples<tuple<_T1s..., _T2s...>,
1661 _Rem...>::__type __type;
1665 template<
typename... _Tpls>
1666 struct __tuple_cat_result
1668 typedef typename __combine_tuples
1669 <
typename __make_tuple<_Tpls>::__type...>::__type __type;
1674 template<
typename...>
1675 struct __make_1st_indices;
1678 struct __make_1st_indices<>
1680 typedef _Index_tuple<> __type;
1683 template<
typename _Tp,
typename... _Tpls>
1684 struct __make_1st_indices<_Tp, _Tpls...>
1686 typedef typename _Build_index_tuple<tuple_size<
1687 typename remove_reference<_Tp>::type>::value>::__type __type;
1693 template<
typename _Ret,
typename _Indices,
typename... _Tpls>
1694 struct __tuple_concater;
1696 template<
typename _Ret,
size_t... _Is,
typename _Tp,
typename... _Tpls>
1697 struct __tuple_concater<_Ret, _Index_tuple<_Is...>, _Tp, _Tpls...>
1699 template<
typename... _Us>
1700 static constexpr _Ret
1701 _S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us)
1703 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
1704 typedef __tuple_concater<_Ret, __idx, _Tpls...> __next;
1705 return __next::_S_do(std::forward<_Tpls>(__tps)...,
1706 std::forward<_Us>(__us)...,
1707 std::get<_Is>(std::forward<_Tp>(__tp))...);
1711 template<
typename _Ret>
1712 struct __tuple_concater<_Ret, _Index_tuple<>>
1714 template<
typename... _Us>
1715 static constexpr _Ret
1716 _S_do(_Us&&... __us)
1718 return _Ret(std::forward<_Us>(__us)...);
1722 template<
typename... _Tps>
1723 struct __is_tuple_like_impl<tuple<_Tps...>> :
true_type
1727 template<
typename... _Tpls,
typename =
typename
1728 enable_if<__and_<__is_tuple_like<_Tpls>...>::value>::type>
1731 ->
typename __tuple_cat_result<_Tpls...>::__type
1733 typedef typename __tuple_cat_result<_Tpls...>::__type __ret;
1734 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
1735 typedef __tuple_concater<__ret, __idx, _Tpls...> __concater;
1736 return __concater::_S_do(std::forward<_Tpls>(__tpls)...);
1742 template<
typename... _Elements>
1743 constexpr tuple<_Elements&...>
1744 tie(_Elements&... __args) noexcept
1745 {
return tuple<_Elements&...>(__args...); }
1748 template<
typename... _Elements>
1749 _GLIBCXX20_CONSTEXPR
1751 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
1753 typename enable_if<__and_<__is_swappable<_Elements>...>::value
1759 noexcept(noexcept(__x.swap(__y)))
1762 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
1763 template<
typename... _Elements>
1764 _GLIBCXX20_CONSTEXPR
1765 typename enable_if<!__and_<__is_swappable<_Elements>...>::value>::type
1766 swap(tuple<_Elements...>&, tuple<_Elements...>&) =
delete;
1773 struct _Swallow_assign
1776 _GLIBCXX14_CONSTEXPR
const _Swallow_assign&
1777 operator=(
const _Tp&)
const
1783 _GLIBCXX17_INLINE constexpr _Swallow_assign ignore{};
1786 template<
typename... _Types,
typename _Alloc>
1798 template<
class _T1,
class _T2>
1799 template<
typename... _Args1,
typename... _Args2>
1800 _GLIBCXX20_CONSTEXPR
1805 :
pair(__first, __second,
1806 typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
1807 typename _Build_index_tuple<sizeof...(_Args2)>::__type())
1810 template<
class _T1,
class _T2>
1811 template<
typename... _Args1,
size_t... _Indexes1,
1812 typename... _Args2,
size_t... _Indexes2>
1813 _GLIBCXX20_CONSTEXPR
inline
1816 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>)
1817 : first(
std::
forward<_Args1>(
std::get<_Indexes1>(__tuple1))...),
1818 second(
std::
forward<_Args2>(
std::get<_Indexes2>(__tuple2))...)
1821 #if __cplusplus >= 201703L
1827 template<
template<
typename...>
class _Trait,
typename _Tp,
typename _Tuple>
1828 inline constexpr
bool __unpack_std_tuple =
false;
1830 template<
template<
typename...>
class _Trait,
typename _Tp,
typename... _Up>
1831 inline constexpr
bool __unpack_std_tuple<_Trait, _Tp, tuple<_Up...>>
1832 = _Trait<_Tp, _Up...>::value;
1834 template<
template<
typename...>
class _Trait,
typename _Tp,
typename... _Up>
1835 inline constexpr
bool __unpack_std_tuple<_Trait, _Tp, tuple<_Up...>&>
1836 = _Trait<_Tp, _Up&...>::value;
1838 template<
template<
typename...>
class _Trait,
typename _Tp,
typename... _Up>
1839 inline constexpr
bool __unpack_std_tuple<_Trait, _Tp,
const tuple<_Up...>>
1840 = _Trait<_Tp,
const _Up...>::value;
1842 template<
template<
typename...>
class _Trait,
typename _Tp,
typename... _Up>
1843 inline constexpr
bool __unpack_std_tuple<_Trait, _Tp,
const tuple<_Up...>&>
1844 = _Trait<_Tp,
const _Up&...>::value;
1846 # define __cpp_lib_apply 201603L
1848 template <
typename _Fn,
typename _Tuple,
size_t... _Idx>
1849 constexpr decltype(
auto)
1853 std::get<_Idx>(std::forward<_Tuple>(__t))...);
1856 template <
typename _Fn,
typename _Tuple>
1857 constexpr decltype(
auto)
1858 apply(_Fn&& __f, _Tuple&& __t)
1859 noexcept(__unpack_std_tuple<is_nothrow_invocable, _Fn, _Tuple>)
1862 = make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>;
1863 return std::__apply_impl(std::forward<_Fn>(__f),
1864 std::forward<_Tuple>(__t),
1868 #define __cpp_lib_make_from_tuple 201606L
1870 template <
typename _Tp,
typename _Tuple,
size_t... _Idx>
1872 __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>)
1873 {
return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...); }
1875 template <
typename _Tp,
typename _Tuple>
1877 make_from_tuple(_Tuple&& __t)
1878 noexcept(__unpack_std_tuple<is_nothrow_constructible, _Tp, _Tuple>)
1880 return __make_from_tuple_impl<_Tp>(
1881 std::forward<_Tuple>(__t),
1888 _GLIBCXX_END_NAMESPACE_VERSION
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
constexpr auto tuple_cat(_Tpls &&... __tpls) -> typename __tuple_cat_result< _Tpls... >::__type
tuple_cat
constexpr tuple< _Elements &... > tie(_Elements &... __args) noexcept
tie
constexpr __invoke_result< _Callable, _Args... >::type __invoke(_Callable &&__fn, _Args &&... __args) noexcept(__is_nothrow_invocable< _Callable, _Args... >::value)
Invoke a callable object.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr tuple< _Elements &&... > forward_as_tuple(_Elements &&... __args) noexcept
std::forward_as_tuple
constexpr const _Tp && get(const tuple< _Types... > &&__t) noexcept
Return a const reference to the unique element of type _Tp of a const tuple rvalue.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
ISO C++ entities toplevel namespace is std.
make_integer_sequence< size_t, _Num > make_index_sequence
Alias template make_index_sequence.
integer_sequence< size_t, _Idx... > index_sequence
Alias template index_sequence.
Primary class template, tuple.
Partial specialization, 2-element tuple. Includes construction and assignment from a pair.
is_nothrow_default_constructible
Declare uses_allocator so it can be specialized in <queue> etc.
Struct holding two objects of arbitrary type.
Tag type for piecewise construction of std::pair objects.
Finds the size of a given tuple type.
Gives the type of the ith element of a given tuple type.