@@ -1182,13 +1182,21 @@ public:
1182
1182
_LIBCPP_HIDE_FROM_ABI constexpr variant (const variant&) = default;
1183
1183
_LIBCPP_HIDE_FROM_ABI constexpr variant (variant&&) = default;
1184
1184
1185
- template < class _Arg ,
1186
- enable_if_t <!is_same_v<__remove_cvref_t <_Arg>, variant>, int > = 0 ,
1187
- enable_if_t <!__is_inplace_type<__remove_cvref_t <_Arg>>::value, int > = 0 ,
1188
- enable_if_t <!__is_inplace_index<__remove_cvref_t <_Arg>>::value, int > = 0 ,
1189
- class _Tp = __variant_detail::__best_match_t <_Arg, _Types...>,
1190
- size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
1191
- enable_if_t <is_constructible_v<_Tp, _Arg>, int > = 0 >
1185
+ template <class _Arg ,
1186
+ bool = !is_same_v<__remove_cvref_t <_Arg>, variant> && !__is_inplace_type<__remove_cvref_t <_Arg>>::value &&
1187
+ !__is_inplace_index<__remove_cvref_t <_Arg>>::value,
1188
+ class = void >
1189
+ struct __arg_overload_type {};
1190
+
1191
+ template <class _Arg >
1192
+ struct __arg_overload_type <_Arg, true , __void_t <__variant_detail::__best_match_t <_Arg, _Types...>>> {
1193
+ using type _LIBCPP_NODEBUG = __variant_detail::__best_match_t <_Arg, _Types...>;
1194
+ };
1195
+
1196
+ template <class _Arg ,
1197
+ class _Tp = typename __arg_overload_type<_Arg>::type,
1198
+ size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
1199
+ enable_if_t <is_constructible_v<_Tp, _Arg>, int > = 0 >
1192
1200
_LIBCPP_HIDE_FROM_ABI constexpr variant (_Arg&& __arg) noexcept (is_nothrow_constructible_v<_Tp, _Arg>)
1193
1201
: __impl_(in_place_index<_Ip>, std::forward<_Arg>(__arg)) {}
1194
1202
0 commit comments