29 #ifndef _GLIBCXX_TUPLE
30 #define _GLIBCXX_TUPLE 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
40 #include <bits/uses_allocator.h>
42 namespace std _GLIBCXX_VISIBILITY(default)
44 _GLIBCXX_BEGIN_NAMESPACE_VERSION
52 template<
typename _Tp>
54 {
typedef const _Tp& type; };
56 template<
typename _Tp>
57 struct __add_c_ref<_Tp&>
58 {
typedef _Tp& type; };
61 template<
typename _Tp>
63 {
typedef _Tp& type; };
65 template<
typename _Tp>
66 struct __add_ref<_Tp&>
67 {
typedef _Tp& type; };
70 template<
typename _Tp>
72 {
typedef _Tp&& type; };
74 template<
typename _Tp>
75 struct __add_r_ref<_Tp&>
76 {
typedef _Tp& type; };
78 template<std::
size_t _Idx,
typename _Head,
bool _IsEmptyNotFinal>
81 template<std::
size_t _Idx,
typename _Head>
82 struct _Head_base<_Idx, _Head, true>
85 constexpr _Head_base()
88 constexpr _Head_base(
const _Head& __h)
91 template<
typename _UHead,
typename =
typename
92 enable_if<!is_convertible<_UHead,
93 __uses_alloc_base>::value>::type>
94 constexpr _Head_base(_UHead&& __h)
95 : _Head(std::
forward<_UHead>(__h)) { }
97 _Head_base(__uses_alloc0)
100 template<
typename _Alloc>
101 _Head_base(__uses_alloc1<_Alloc> __a)
102 : _Head(allocator_arg, *__a._M_a) { }
104 template<
typename _Alloc>
105 _Head_base(__uses_alloc2<_Alloc> __a)
106 : _Head(*__a._M_a) { }
108 template<
typename _UHead>
109 _Head_base(__uses_alloc0, _UHead&& __uhead)
110 : _Head(std::
forward<_UHead>(__uhead)) { }
112 template<
typename _Alloc,
typename _UHead>
113 _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
114 : _Head(allocator_arg, *__a._M_a, std::
forward<_UHead>(__uhead)) { }
116 template<
typename _Alloc,
typename _UHead>
117 _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
118 : _Head(std::
forward<_UHead>(__uhead), *__a._M_a) { }
120 static constexpr _Head&
121 _M_head(_Head_base& __b) noexcept {
return __b; }
123 static constexpr
const _Head&
124 _M_head(
const _Head_base& __b) noexcept {
return __b; }
127 template<std::
size_t _Idx,
typename _Head>
128 struct _Head_base<_Idx, _Head, false>
130 constexpr _Head_base()
133 constexpr _Head_base(
const _Head& __h)
134 : _M_head_impl(__h) { }
136 template<
typename _UHead,
typename =
typename
137 enable_if<!is_convertible<_UHead,
138 __uses_alloc_base>::value>::type>
139 constexpr _Head_base(_UHead&& __h)
140 : _M_head_impl(std::
forward<_UHead>(__h)) { }
142 _Head_base(__uses_alloc0)
145 template<
typename _Alloc>
146 _Head_base(__uses_alloc1<_Alloc> __a)
147 : _M_head_impl(allocator_arg, *__a._M_a) { }
149 template<
typename _Alloc>
150 _Head_base(__uses_alloc2<_Alloc> __a)
151 : _M_head_impl(*__a._M_a) { }
153 template<
typename _UHead>
154 _Head_base(__uses_alloc0, _UHead&& __uhead)
155 : _M_head_impl(std::
forward<_UHead>(__uhead)) { }
157 template<
typename _Alloc,
typename _UHead>
158 _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead)
159 : _M_head_impl(allocator_arg, *__a._M_a, std::
forward<_UHead>(__uhead))
162 template<
typename _Alloc,
typename _UHead>
163 _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead)
164 : _M_head_impl(std::
forward<_UHead>(__uhead), *__a._M_a) { }
166 static constexpr _Head&
167 _M_head(_Head_base& __b) noexcept {
return __b._M_head_impl; }
169 static constexpr
const _Head&
170 _M_head(
const _Head_base& __b) noexcept {
return __b._M_head_impl; }
183 template<std::size_t _Idx,
typename... _Elements>
190 template<std::
size_t _Idx>
193 template<std::size_t,
typename...>
friend class _Tuple_impl;
197 template<
typename _Alloc>
200 template<
typename _Alloc>
203 template<
typename _Alloc>
210 template<
typename _Tp>
214 template<
typename _El0,
typename... _El>
215 struct __is_empty_non_tuple<tuple<_El0, _El...>> :
false_type { };
218 template<
typename _Tp>
219 using __empty_not_final
220 =
typename conditional<__is_final(_Tp),
false_type,
221 __is_empty_non_tuple<_Tp>>::type;
228 template<std::size_t _Idx,
typename _Head,
typename... _Tail>
231 private _Head_base<_Idx, _Head, __empty_not_final<_Head>::value>
233 template<std::size_t,
typename...>
friend class _Tuple_impl;
236 typedef _Head_base<_Idx, _Head, __empty_not_final<_Head>::value> _Base;
238 static constexpr _Head&
239 _M_head(
_Tuple_impl& __t) noexcept {
return _Base::_M_head(__t); }
241 static constexpr
const _Head&
242 _M_head(
const _Tuple_impl& __t) noexcept {
return _Base::_M_head(__t); }
248 _M_tail(
const _Tuple_impl& __t) noexcept {
return __t; }
254 constexpr _Tuple_impl(
const _Head& __head,
const _Tail&... __tail)
257 template<
typename _UHead,
typename... _UTail,
typename =
typename
258 enable_if<
sizeof...(_Tail) ==
sizeof...(_UTail)>::type>
260 constexpr _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
261 :
_Inherited(std::forward<_UTail>(__tail)...),
262 _Base(std::forward<_UHead>(__head)) { }
264 constexpr _Tuple_impl(
const _Tuple_impl&) =
default;
267 _Tuple_impl(_Tuple_impl&& __in)
268 noexcept(__and_<is_nothrow_move_constructible<_Head>,
269 is_nothrow_move_constructible<_Inherited>>::value)
271 _Base(std::forward<_Head>(_M_head(__in))) { }
273 template<
typename... _UElements>
278 template<
typename _UHead,
typename... _UTails>
282 _Base(std::forward<_UHead>
285 template<
typename _Alloc>
288 _Base(__use_alloc<_Head>(__a)) { }
290 template<
typename _Alloc>
292 const _Head& __head,
const _Tail&... __tail)
294 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head) { }
296 template<
typename _Alloc,
typename _UHead,
typename... _UTail,
297 typename =
typename enable_if<
sizeof...(_Tail)
298 ==
sizeof...(_UTail)>::type>
300 _UHead&& __head, _UTail&&... __tail)
301 :
_Inherited(__tag, __a, std::forward<_UTail>(__tail)...),
302 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
303 std::forward<_UHead>(__head)) { }
305 template<
typename _Alloc>
307 const _Tuple_impl& __in)
309 _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in)) { }
311 template<
typename _Alloc>
314 :
_Inherited(__tag, __a, std::move(_M_tail(__in))),
315 _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
316 std::forward<_Head>(_M_head(__in))) { }
318 template<
typename _Alloc,
typename... _UElements>
323 _Base(__use_alloc<_Head, _Alloc, _Head>(__a),
326 template<
typename _Alloc,
typename _UHead,
typename... _UTails>
331 _Base(__use_alloc<_Head, _Alloc, _UHead>(__a),
336 operator=(
const _Tuple_impl& __in)
338 _M_head(*
this) = _M_head(__in);
339 _M_tail(*
this) = _M_tail(__in);
344 operator=(_Tuple_impl&& __in)
345 noexcept(__and_<is_nothrow_move_assignable<_Head>,
346 is_nothrow_move_assignable<_Inherited>>::value)
348 _M_head(*
this) = std::forward<_Head>(_M_head(__in));
349 _M_tail(*
this) = std::move(_M_tail(__in));
353 template<
typename... _UElements>
362 template<
typename _UHead,
typename... _UTails>
366 _M_head(*
this) = std::forward<_UHead>
368 _M_tail(*
this) = std::move
375 _M_swap(_Tuple_impl& __in)
376 noexcept(noexcept(
swap(std::declval<_Head&>(),
377 std::declval<_Head&>()))
378 && noexcept(_M_tail(__in)._M_swap(_M_tail(__in))))
381 swap(_M_head(*
this), _M_head(__in));
382 _Inherited::_M_swap(_M_tail(__in));
387 template<
typename... _Elements>
397 constexpr tuple(
const _Elements&... __elements)
400 template<
typename... _UElements,
typename =
typename
401 enable_if<__and_<is_convertible<_UElements,
402 _Elements>...>::value>::type>
404 constexpr tuple(_UElements&&... __elements)
405 :
_Inherited(std::forward<_UElements>(__elements)...) { }
407 constexpr tuple(
const tuple&) =
default;
409 constexpr tuple(tuple&&) =
default;
411 template<
typename... _UElements,
typename =
typename
412 enable_if<__and_<is_convertible<
const _UElements&,
413 _Elements>...>::value>::type>
418 template<
typename... _UElements,
typename =
typename
419 enable_if<__and_<is_convertible<_UElements,
420 _Elements>...>::value>::type>
426 template<
typename _Alloc>
430 template<
typename _Alloc>
432 const _Elements&... __elements)
435 template<
typename _Alloc,
typename... _UElements,
typename =
typename
436 enable_if<
sizeof...(_UElements)
437 ==
sizeof...(_Elements)>::type>
439 _UElements&&... __elements)
440 :
_Inherited(__tag, __a, std::forward<_UElements>(__elements)...)
443 template<
typename _Alloc>
445 :
_Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
447 template<
typename _Alloc>
449 :
_Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
451 template<
typename _Alloc,
typename... _UElements,
typename =
typename
452 enable_if<
sizeof...(_UElements)
453 ==
sizeof...(_Elements)>::type>
457 static_cast<const _Tuple_impl<0, _UElements...
>&>(__in))
460 template<
typename _Alloc,
typename... _UElements,
typename =
typename
461 enable_if<
sizeof...(_UElements)
462 ==
sizeof...(_Elements)>::type>
466 static_cast<_Tuple_impl<0, _UElements...
>&&>(__in))
470 operator=(
const tuple& __in)
477 operator=(tuple&& __in)
478 noexcept(is_nothrow_move_assignable<_Inherited>::value)
480 static_cast<_Inherited&
>(*this) = std::move(__in);
484 template<
typename... _UElements,
typename =
typename
485 enable_if<
sizeof...(_UElements)
486 ==
sizeof...(_Elements)>::type>
494 template<
typename... _UElements,
typename =
typename
495 enable_if<
sizeof...(_UElements)
496 ==
sizeof...(_Elements)>::type>
500 static_cast<_Inherited&
>(*this) = std::move(__in);
506 noexcept(noexcept(__in._M_swap(__in)))
507 { _Inherited::_M_swap(__in); }
520 template<
typename _T1,
typename _T2>
530 constexpr tuple(
const _T1& __a1,
const _T2& __a2)
533 template<
typename _U1,
typename _U2,
typename =
typename
534 enable_if<__and_<is_convertible<_U1, _T1>,
535 is_convertible<_U2, _T2>>::value>::type>
537 constexpr tuple(_U1&& __a1, _U2&& __a2)
538 :
_Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
540 constexpr tuple(
const tuple&) =
default;
542 constexpr tuple(tuple&&) =
default;
544 template<
typename _U1,
typename _U2,
typename =
typename
545 enable_if<__and_<is_convertible<const _U1&, _T1>,
546 is_convertible<const _U2&, _T2>>::value>::type>
550 template<
typename _U1,
typename _U2,
typename =
typename
551 enable_if<__and_<is_convertible<_U1, _T1>,
552 is_convertible<_U2, _T2>>::value>::type>
556 template<
typename _U1,
typename _U2,
typename =
typename
557 enable_if<__and_<is_convertible<const _U1&, _T1>,
558 is_convertible<const _U2&, _T2>>::value>::type>
562 template<
typename _U1,
typename _U2,
typename =
typename
563 enable_if<__and_<is_convertible<_U1, _T1>,
564 is_convertible<_U2, _T2>>::value>::type>
567 std::forward<_U2>(__in.
second)) { }
571 template<
typename _Alloc>
575 template<
typename _Alloc>
577 const _T1& __a1,
const _T2& __a2)
580 template<
typename _Alloc,
typename _U1,
typename _U2>
581 tuple(
allocator_arg_t __tag,
const _Alloc& __a, _U1&& __a1, _U2&& __a2)
582 :
_Inherited(__tag, __a, std::forward<_U1>(__a1),
583 std::forward<_U2>(__a2)) { }
585 template<
typename _Alloc>
587 :
_Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
589 template<
typename _Alloc>
591 :
_Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
593 template<
typename _Alloc,
typename _U1,
typename _U2>
600 template<
typename _Alloc,
typename _U1,
typename _U2>
605 template<
typename _Alloc,
typename _U1,
typename _U2>
610 template<
typename _Alloc,
typename _U1,
typename _U2>
613 std::forward<_U2>(__in.
second)) { }
616 operator=(
const tuple& __in)
623 operator=(tuple&& __in)
624 noexcept(is_nothrow_move_assignable<_Inherited>::value)
626 static_cast<_Inherited&
>(*this) = std::move(__in);
630 template<
typename _U1,
typename _U2>
638 template<
typename _U1,
typename _U2>
642 static_cast<_Inherited&
>(*this) = std::move(__in);
646 template<
typename _U1,
typename _U2>
650 this->_M_head(*
this) = __in.
first;
651 this->_M_tail(*this)._M_head(*
this) = __in.
second;
655 template<
typename _U1,
typename _U2>
659 this->_M_head(*
this) = std::forward<_U1>(__in.
first);
660 this->_M_tail(*this)._M_head(*
this) = std::forward<_U2>(__in.
second);
666 noexcept(noexcept(__in._M_swap(__in)))
667 { _Inherited::_M_swap(__in); }
672 template<std::
size_t __i,
typename _Tp>
679 template<std::size_t __i,
typename _Head,
typename... _Tail>
686 template<
typename _Head,
typename... _Tail>
692 template<std::
size_t __i,
typename _Tp>
696 add_const<typename tuple_element<__i, _Tp>::type>::type type;
699 template<std::
size_t __i,
typename _Tp>
700 struct tuple_element<__i, volatile _Tp>
703 add_volatile<typename tuple_element<__i, _Tp>::type>::type type;
706 template<std::
size_t __i,
typename _Tp>
707 struct tuple_element<__i, const volatile _Tp>
710 add_cv<typename tuple_element<__i, _Tp>::type>::type type;
714 template<
typename _Tp>
717 template<
typename _Tp>
718 struct tuple_size<const _Tp>
719 :
public integral_constant<
720 typename remove_cv<decltype(tuple_size<_Tp>::value)>::type,
721 tuple_size<_Tp>::value> { };
723 template<
typename _Tp>
724 struct tuple_size<volatile _Tp>
725 :
public integral_constant<
726 typename remove_cv<decltype(tuple_size<_Tp>::value)>::type,
727 tuple_size<_Tp>::value> { };
729 template<
typename _Tp>
730 struct tuple_size<const volatile _Tp>
731 :
public integral_constant<
732 typename remove_cv<decltype(tuple_size<_Tp>::value)>::type,
733 tuple_size<_Tp>::value> { };
736 template<
typename... _Elements>
740 template<std::size_t __i,
typename _Head,
typename... _Tail>
741 constexpr
typename __add_ref<_Head>::type
745 template<std::size_t __i,
typename _Head,
typename... _Tail>
746 constexpr
typename __add_c_ref<_Head>::type
747 __get_helper(
const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
748 {
return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
753 template<std::size_t __i,
typename... _Elements>
754 constexpr
typename __add_ref<
755 typename tuple_element<__i, tuple<_Elements...>>::type
757 get(tuple<_Elements...>& __t) noexcept
758 {
return __get_helper<__i>(__t); }
760 template<std::size_t __i,
typename... _Elements>
761 constexpr
typename __add_c_ref<
762 typename tuple_element<__i, tuple<_Elements...>>::type
764 get(
const tuple<_Elements...>& __t) noexcept
765 {
return __get_helper<__i>(__t); }
767 template<std::size_t __i,
typename... _Elements>
768 constexpr
typename __add_r_ref<
769 typename tuple_element<__i, tuple<_Elements...>>::type
771 get(tuple<_Elements...>&& __t) noexcept
773 tuple<_Elements...>>::type&&>(get<__i>(__t)); }
775 #if __cplusplus > 201103L
776 template<
typename _Head,
size_t __i,
typename... _Tail>
777 constexpr
typename __add_ref<_Head>::type
778 __get_helper2(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
779 {
return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
781 template<
typename _Head,
size_t __i,
typename... _Tail>
782 constexpr
typename __add_c_ref<_Head>::type
783 __get_helper2(
const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
784 {
return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); }
786 template <
typename _Tp,
typename... _Types>
788 get(tuple<_Types...>& __t) noexcept
789 {
return __get_helper2<_Tp>(__t); }
791 template <
typename _Tp,
typename... _Types>
793 get(tuple<_Types...>&& __t) noexcept
794 {
return std::move(__get_helper2<_Tp>(__t)); }
796 template <
typename _Tp,
typename... _Types>
798 get(
const tuple<_Types...>& __t) noexcept
799 {
return __get_helper2<_Tp>(__t); }
803 template<std::size_t __check_equal_size, std::size_t __i, std::size_t __j,
804 typename _Tp,
typename _Up>
805 struct __tuple_compare;
807 template<std::
size_t __i, std::
size_t __j,
typename _Tp,
typename _Up>
808 struct __tuple_compare<0, __i, __j, _Tp, _Up>
810 static constexpr
bool
811 __eq(
const _Tp& __t,
const _Up& __u)
813 return (get<__i>(__t) == get<__i>(__u) &&
814 __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__eq(__t, __u));
817 static constexpr
bool
818 __less(
const _Tp& __t,
const _Up& __u)
820 return ((get<__i>(__t) < get<__i>(__u))
821 || !(get<__i>(__u) < get<__i>(__t)) &&
822 __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__less(__t, __u));
826 template<std::
size_t __i,
typename _Tp,
typename _Up>
827 struct __tuple_compare<0, __i, __i, _Tp, _Up>
829 static constexpr
bool
830 __eq(
const _Tp&,
const _Up&) {
return true; }
832 static constexpr
bool
833 __less(
const _Tp&,
const _Up&) {
return false; }
836 template<
typename... _TElements,
typename... _UElements>
838 operator==(
const tuple<_TElements...>& __t,
839 const tuple<_UElements...>& __u)
841 typedef tuple<_TElements...> _Tp;
842 typedef tuple<_UElements...> _Up;
843 return bool(__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
844 0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u));
847 template<
typename... _TElements,
typename... _UElements>
849 operator<(
const tuple<_TElements...>& __t,
850 const tuple<_UElements...>& __u)
852 typedef tuple<_TElements...> _Tp;
853 typedef tuple<_UElements...> _Up;
854 return bool(__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
855 0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u));
858 template<
typename... _TElements,
typename... _UElements>
860 operator!=(
const tuple<_TElements...>& __t,
861 const tuple<_UElements...>& __u)
862 {
return !(__t == __u); }
864 template<
typename... _TElements,
typename... _UElements>
866 operator>(
const tuple<_TElements...>& __t,
867 const tuple<_UElements...>& __u)
868 {
return __u < __t; }
870 template<
typename... _TElements,
typename... _UElements>
872 operator<=(
const tuple<_TElements...>& __t,
873 const tuple<_UElements...>& __u)
874 {
return !(__u < __t); }
876 template<
typename... _TElements,
typename... _UElements>
878 operator>=(
const tuple<_TElements...>& __t,
879 const tuple<_UElements...>& __u)
880 {
return !(__t < __u); }
883 template<
typename... _Elements>
884 constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
885 make_tuple(_Elements&&... __args)
887 typedef tuple<typename __decay_and_strip<_Elements>::__type...>
889 return __result_type(std::forward<_Elements>(__args)...);
892 template<
typename... _Elements>
893 tuple<_Elements&&...>
894 forward_as_tuple(_Elements&&... __args) noexcept
895 {
return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
901 template<
typename... _Tps>
902 struct __is_tuple_like_impl<tuple<_Tps...>> :
true_type
905 template<
typename _T1,
typename _T2>
906 struct __is_tuple_like_impl<pair<_T1, _T2>> :
true_type
909 template<
typename _Tp, std::
size_t _Nm>
910 struct __is_tuple_like_impl<array<_Tp, _Nm>> :
true_type
914 template<
typename _Tp>
915 struct __is_tuple_like
916 :
public __is_tuple_like_impl<typename std::remove_cv
917 <typename std::remove_reference<_Tp>::type>::type>::type
920 template<std::
size_t,
typename,
typename, std::
size_t>
921 struct __make_tuple_impl;
923 template<std::size_t _Idx,
typename _Tuple,
typename... _Tp,
925 struct __make_tuple_impl<_Idx, tuple<_Tp...>, _Tuple, _Nm>
927 typedef typename __make_tuple_impl<_Idx + 1, tuple<_Tp...,
932 template<std::size_t _Nm,
typename _Tuple,
typename... _Tp>
933 struct __make_tuple_impl<_Nm, tuple<_Tp...>, _Tuple, _Nm>
935 typedef tuple<_Tp...> __type;
938 template<
typename _Tuple>
939 struct __do_make_tuple
940 :
public __make_tuple_impl<0, tuple<>, _Tuple,
941 std::tuple_size<_Tuple>::value>
945 template<
typename _Tuple>
947 :
public __do_make_tuple<typename std::remove_cv
948 <typename std::remove_reference<_Tuple>::type>::type>
952 template<
typename...>
953 struct __combine_tuples;
956 struct __combine_tuples<>
958 typedef tuple<> __type;
961 template<
typename... _Ts>
962 struct __combine_tuples<tuple<_Ts...>>
964 typedef tuple<_Ts...> __type;
967 template<
typename... _T1s,
typename... _T2s,
typename... _Rem>
968 struct __combine_tuples<tuple<_T1s...>, tuple<_T2s...>, _Rem...>
970 typedef typename __combine_tuples<tuple<_T1s..., _T2s...>,
971 _Rem...>::__type __type;
975 template<
typename... _Tpls>
976 struct __tuple_cat_result
978 typedef typename __combine_tuples
984 template<
typename...>
985 struct __make_1st_indices;
988 struct __make_1st_indices<>
990 typedef std::_Index_tuple<> __type;
993 template<
typename _Tp,
typename... _Tpls>
994 struct __make_1st_indices<_Tp, _Tpls...>
997 typename std::remove_reference<_Tp>::type>::value>::__type __type;
1003 template<
typename _Ret,
typename _Indices,
typename... _Tpls>
1004 struct __tuple_concater;
1006 template<
typename _Ret, std::size_t... _Is,
typename _Tp,
typename... _Tpls>
1007 struct __tuple_concater<_Ret, std::_Index_tuple<_Is...>, _Tp, _Tpls...>
1009 template<
typename... _Us>
1010 static constexpr _Ret
1011 _S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us)
1013 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
1014 typedef __tuple_concater<_Ret, __idx, _Tpls...> __next;
1015 return __next::_S_do(std::forward<_Tpls>(__tps)...,
1016 std::forward<_Us>(__us)...,
1017 std::get<_Is>(std::forward<_Tp>(__tp))...);
1021 template<
typename _Ret>
1022 struct __tuple_concater<_Ret, std::_Index_tuple<>>
1024 template<
typename... _Us>
1025 static constexpr _Ret
1026 _S_do(_Us&&... __us)
1028 return _Ret(std::forward<_Us>(__us)...);
1033 template<
typename... _Tpls,
typename =
typename
1034 enable_if<__and_<__is_tuple_like<_Tpls>...>::value>::type>
1036 tuple_cat(_Tpls&&... __tpls)
1037 ->
typename __tuple_cat_result<_Tpls...>::__type
1039 typedef typename __tuple_cat_result<_Tpls...>::__type __ret;
1040 typedef typename __make_1st_indices<_Tpls...>::__type __idx;
1041 typedef __tuple_concater<__ret, __idx, _Tpls...> __concater;
1042 return __concater::_S_do(std::forward<_Tpls>(__tpls)...);
1046 template<
typename... _Elements>
1047 inline tuple<_Elements&...>
1048 tie(_Elements&... __args) noexcept
1049 {
return tuple<_Elements&...>(__args...); }
1052 template<
typename... _Elements>
1054 swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
1060 struct _Swallow_assign
1063 const _Swallow_assign&
1064 operator=(
const _Tp&)
const
1068 const _Swallow_assign ignore{};
1071 template<
typename... _Types,
typename _Alloc>
1075 template<
class _T1,
class _T2>
1076 template<
typename... _Args1,
typename... _Args2>
1081 :
pair(__first, __second,
1082 typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
1083 typename _Build_index_tuple<sizeof...(_Args2)>::__type())
1086 template<
class _T1,
class _T2>
1087 template<
typename... _Args1, std::size_t... _Indexes1,
1088 typename... _Args2, std::size_t... _Indexes2>
1091 pair(tuple<_Args1...>& __tuple1, tuple<_Args2...>& __tuple2,
1092 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>)
1093 : first(std::
forward<_Args1>(std::get<_Indexes1>(__tuple1))...),
1094 second(std::
forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
1099 _GLIBCXX_END_NAMESPACE_VERSION
1104 #endif // _GLIBCXX_TUPLE
Primary class template, tuple.
_T2 second
first is a copy of the first object
__combine_tuples< typename __make_tuple< _Tpls >::__type...>::__type __type
tuple_cat
_T1 first
second_type is the second bound type
Declare uses_allocator so it can be specialized in <queue> etc.
constexpr pair()
second is a copy of the second object
Struct holding two objects of arbitrary type.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
tuple< _Elements &...> tie(_Elements &...__args) noexcept
tie
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.