@@ -537,25 +537,32 @@ static constexpr auto __make_vtable(_Fp __f) {
537
537
}
538
538
539
539
struct __base {
540
+ template <class _Vis , class ... _Vs>
541
+ struct __dispatch {
542
+ template <size_t ... _Is>
543
+ inline _LIBCPP_INLINE_VISIBILITY
544
+ constexpr auto operator ()(integral_constant<size_t , _Is>...) const noexcept {
545
+ return +[](_Vis&& __vis, _Vs&&... __vs) -> decltype (auto ) {
546
+ return __invoke_constexpr (
547
+ _VSTD::forward<_Vis>(__vis),
548
+ __access::__base::__get_alt<_Is>(_VSTD::forward<_Vs>(__vs))...);
549
+ };
550
+ }
551
+ };
552
+
540
553
template <class _Vis , class _Vp , class _Wp >
541
554
inline _LIBCPP_INLINE_VISIBILITY
542
555
static constexpr decltype (auto )
543
556
__visit_alt_at(size_t __index, _Vis&& __vis, _Vp&& __v, _Wp&& __w) {
544
557
constexpr size_t __size = __uncvref_t <_Vp>::__size ();
545
558
static_assert (__size == __uncvref_t <_Wp>::__size ());
546
- constexpr auto __dispatch = [](auto __i) {
547
- return +[](_Vis&& __vis_, _Vp&& __v_, _Wp&& __w_) -> decltype (auto ) {
548
- constexpr size_t _Ip = decltype (__i)::value;
549
- return __invoke_constexpr (
550
- _VSTD::forward<_Vis>(__vis_),
551
- __access::__base::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v_)),
552
- __access::__base::__get_alt<_Ip>(_VSTD::forward<_Wp>(__w_)));
553
- };
559
+ constexpr auto __dispatch_at = [](auto __i) {
560
+ return __dispatch<_Vis, _Vp, _Wp>{}(__i, __i);
554
561
};
555
562
#define _LIBCPP_VARIANT_CASE (_Ip ) \
556
563
case _Ip: { \
557
564
if constexpr (_Ip < __size) { \
558
- return __dispatch (integral_constant<size_t , _Ip>{})( \
565
+ return __dispatch_at (integral_constant<size_t , _Ip>{})( \
559
566
_VSTD::forward<_Vis>(__vis), \
560
567
_VSTD::forward<_Vp>(__v), \
561
568
_VSTD::forward<_Wp>(__w)); \
@@ -569,7 +576,7 @@ struct __base {
569
576
default : __throw_bad_variant_access ();
570
577
}
571
578
} else {
572
- constexpr auto __vtable = __make_vtable<__size>(__dispatch );
579
+ constexpr auto __vtable = __make_vtable<__size>(__dispatch_at );
573
580
return __vtable[__index + 1 ](_VSTD::forward<_Vis>(__vis),
574
581
_VSTD::forward<_Vp>(__v),
575
582
_VSTD::forward<_Wp>(__w));
@@ -594,14 +601,7 @@ struct __base {
594
601
static constexpr decltype (auto )
595
602
__visit_alt_impl(index_sequence<_Is...>, _Vis&& __vis, _Vs&&... __vs) {
596
603
using __multi = __multi<__uncvref_t <_Vs>::__size ()...>;
597
- constexpr auto __dispatch = [](auto ... __is) {
598
- return +[](_Vis&& __vis_, _Vs&&... __vs_) -> decltype (auto ) {
599
- return __invoke_constexpr (
600
- _VSTD::forward<_Vis>(__vis_),
601
- __access::__base::__get_alt<decltype (__is)::value>(
602
- _VSTD::forward<_Vs>(__vs_))...);
603
- };
604
- };
604
+ constexpr __dispatch<_Vis, _Vs...> __dispatch;
605
605
#define _LIBCPP_VARIANT_CASE (_Ip ) \
606
606
case _Ip: { \
607
607
if constexpr (_Ip < __multi::__size) { \
@@ -874,9 +874,9 @@ protected:
874
874
template <size_t _Ip, class _Tp , class ... _Args>
875
875
inline _LIBCPP_INLINE_VISIBILITY
876
876
static _Tp& __construct_alt (__alt<_Ip, _Tp>& __a, _Args&&... __args) {
877
- auto * result = ::new ((void *)_VSTD::addressof (__a))
877
+ auto * __result = ::new ((void *)_VSTD::addressof (__a))
878
878
__alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...);
879
- return result ->__value ;
879
+ return __result ->__value ;
880
880
}
881
881
882
882
template <class _Rhs >
0 commit comments