@@ -448,33 +448,28 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swallow(_Tp&&...) _NO
448
448
template <class _Indx , class ... _Tp>
449
449
struct __tuple_impl ;
450
450
451
+ struct __forward_args {};
452
+ struct __value_init {};
453
+
451
454
template <size_t ... _Indx, class ... _Tp>
452
455
struct _LIBCPP_DECLSPEC_EMPTY_BASES
453
456
__tuple_impl<__index_sequence<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... {
454
457
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl () noexcept (
455
458
__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
456
459
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>
468
470
_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))... {}
478
473
479
474
template <class _Tuple , __enable_if_t <__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int > = 0 >
480
475
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl (_Tuple&& __t ) noexcept (
@@ -559,38 +554,23 @@ public:
559
554
__enable_if_t < _And< _IsDefault<_Tp>... >::value, int > = 0 >
560
555
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit (_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
561
556
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{}) {}
568
558
569
559
// tuple(const T&...) constructors (including allocator_arg_t variants)
570
560
template <template <class ...> class _And = _And,
571
561
__enable_if_t < _And< _BoolConstant<sizeof ...(_Tp) >= 1 >, is_copy_constructible<_Tp>... >::value, int > = 0 >
572
562
_LIBCPP_HIDE_FROM_ABI
573
563
_LIBCPP_CONSTEXPR_SINCE_CXX14 explicit (_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
574
564
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 ...) {}
580
566
581
567
template <class _Alloc ,
582
568
template <class ...> class _And = _And,
583
569
__enable_if_t < _And< _BoolConstant<sizeof ...(_Tp) >= 1 >, is_copy_constructible<_Tp>... >::value, int > = 0 >
584
570
_LIBCPP_HIDE_FROM_ABI
585
571
_LIBCPP_CONSTEXPR_SINCE_CXX20 explicit (_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
586
572
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 ...) {}
594
574
595
575
// tuple(U&& ...) constructors (including allocator_arg_t variants)
596
576
template <class ... _Up>
@@ -609,25 +589,15 @@ public:
609
589
int > = 0 >
610
590
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit (_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
611
591
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)...) {}
617
593
618
594
template <class _Alloc ,
619
595
class ... _Up,
620
596
__enable_if_t < _And< _BoolConstant<sizeof ...(_Up) == sizeof ...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
621
597
int > = 0 >
622
598
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit (_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
623
599
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)...) {}
631
601
632
602
// Copy and move constructors (including the allocator_arg_t variants)
633
603
tuple (const tuple&) = default ;
0 commit comments