@@ -448,33 +448,28 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swallow(_Tp&&...) _NO
448448template <class _Indx , class ... _Tp>
449449struct __tuple_impl ;
450450
451+ struct __forward_args {};
452+ struct __value_init {};
453+
451454template <size_t ... _Indx, class ... _Tp>
452455struct _LIBCPP_DECLSPEC_EMPTY_BASES
453456 __tuple_impl<__index_sequence<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... {
454457 _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl () noexcept (
455458 __all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
456459
457- template <size_t ... _Uf, class ... _Tf, size_t ... _Ul, class ... _Tl, class ... _Up>
458- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl (
459- __index_sequence<_Uf...>,
460- __tuple_types<_Tf...>,
461- __index_sequence<_Ul...>,
462- __tuple_types<_Tl...>,
463- _Up&&... __u) noexcept (__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
464- __all<is_nothrow_default_constructible<_Tl>::value...>::value)
465- : __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {}
466-
467- template <class _Alloc , size_t ... _Uf, class ... _Tf, size_t ... _Ul, class ... _Tl, class ... _Up>
460+ template <class ... _Args>
461+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl (__forward_args, _Args&&... __args)
462+ : __tuple_leaf<_Indx, _Tp>(std::forward<_Args>(__args))... {}
463+
464+ template <class _Alloc >
465+ _LIBCPP_HIDE_FROM_ABI
466+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl (allocator_arg_t , const _Alloc& __alloc, __value_init)
467+ : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc>(), __alloc)... {}
468+
469+ template <class _Alloc , class ... _Args>
468470 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl (
469- allocator_arg_t ,
470- const _Alloc& __a,
471- __index_sequence<_Uf...>,
472- __tuple_types<_Tf...>,
473- __index_sequence<_Ul...>,
474- __tuple_types<_Tl...>,
475- _Up&&... __u)
476- : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::forward<_Up>(__u))...,
477- __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {}
471+ allocator_arg_t , const _Alloc& __alloc, __forward_args, _Args&&... __args)
472+ : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, _Args>(), __alloc, std::forward<_Args>(__args))... {}
478473
479474 template <class _Tuple , __enable_if_t <__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int > = 0 >
480475 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl (_Tuple&& __t ) noexcept (
@@ -559,38 +554,23 @@ public:
559554 __enable_if_t < _And< _IsDefault<_Tp>... >::value, int > = 0 >
560555 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit (_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
561556 tuple(allocator_arg_t , _Alloc const & __a)
562- : __base_(allocator_arg_t (),
563- __a,
564- __index_sequence<>(),
565- __tuple_types<>(),
566- __make_index_sequence<sizeof...(_Tp)>(),
567- __tuple_types<_Tp...>()) {}
557+ : __base_(allocator_arg_t (), __a, __value_init{}) {}
568558
569559 // tuple(const T&...) constructors (including allocator_arg_t variants)
570560 template <template <class ...> class _And = _And,
571561 __enable_if_t < _And< _BoolConstant<sizeof ...(_Tp) >= 1 >, is_copy_constructible<_Tp>... >::value, int > = 0 >
572562 _LIBCPP_HIDE_FROM_ABI
573563 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit (_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
574564 tuple(const _Tp&... __t ) noexcept (_And<is_nothrow_copy_constructible<_Tp>...>::value)
575- : __base_(__make_index_sequence<sizeof ...(_Tp)>(),
576- __tuple_types<_Tp...>(),
577- __index_sequence<>(),
578- __tuple_types<>(),
579- __t...) {}
565+ : __base_(__forward_args{}, __t ...) {}
580566
581567 template <class _Alloc ,
582568 template <class ...> class _And = _And,
583569 __enable_if_t < _And< _BoolConstant<sizeof ...(_Tp) >= 1 >, is_copy_constructible<_Tp>... >::value, int > = 0 >
584570 _LIBCPP_HIDE_FROM_ABI
585571 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit (_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
586572 tuple(allocator_arg_t , const _Alloc& __a, const _Tp&... __t )
587- : __base_(allocator_arg_t (),
588- __a,
589- __make_index_sequence<sizeof...(_Tp)>(),
590- __tuple_types<_Tp...>(),
591- __index_sequence<>(),
592- __tuple_types<>(),
593- __t...) {}
573+ : __base_(allocator_arg_t (), __a, __forward_args{}, __t ...) {}
594574
595575 // tuple(U&& ...) constructors (including allocator_arg_t variants)
596576 template <class ... _Up>
@@ -609,25 +589,15 @@ public:
609589 int > = 0 >
610590 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit (_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
611591 tuple(_Up&&... __u) noexcept (_And<is_nothrow_constructible<_Tp, _Up>...>::value)
612- : __base_(__make_index_sequence<sizeof ...(_Up)>(),
613- __tuple_types<_Tp...>(),
614- __index_sequence<>(),
615- __tuple_types<>(),
616- std::forward<_Up>(__u)...) {}
592+ : __base_(__forward_args{}, std::forward<_Up>(__u)...) {}
617593
618594 template <class _Alloc ,
619595 class ... _Up,
620596 __enable_if_t < _And< _BoolConstant<sizeof ...(_Up) == sizeof ...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
621597 int > = 0 >
622598 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit (_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
623599 tuple(allocator_arg_t , const _Alloc& __a, _Up&&... __u)
624- : __base_(allocator_arg_t (),
625- __a,
626- __make_index_sequence<sizeof...(_Up)>(),
627- __tuple_types<_Tp...>(),
628- __index_sequence<>(),
629- __tuple_types<>(),
630- std::forward<_Up>(__u)...) {}
600+ : __base_(allocator_arg_t (), __a, __forward_args{}, std::forward<_Up>(__u)...) {}
631601
632602 // Copy and move constructors (including the allocator_arg_t variants)
633603 tuple (const tuple&) = default ;
0 commit comments