From 48f9d8ccd437d1a1483e2256002a95ca2570d17c Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sun, 19 Jun 2022 17:55:49 -0700 Subject: [PATCH] Use conditional `explicit` unconditionally (#2796) --- stl/inc/optional | 47 --------- stl/inc/tuple | 238 ------------------------------------------- stl/inc/utility | 94 ----------------- stl/inc/yvals_core.h | 17 +--- 4 files changed, 3 insertions(+), 393 deletions(-) diff --git a/stl/inc/optional b/stl/inc/optional index ee8698def0a..2e796f49fbf 100644 --- a/stl/inc/optional +++ b/stl/inc/optional @@ -232,18 +232,9 @@ public: using _AllowDirectConversion = bool_constant, optional>>, negation, in_place_t>>, is_constructible<_Ty, _Ty2>>>; -#if _HAS_CONDITIONAL_EXPLICIT template ::value, int> = 0> constexpr explicit(!is_convertible_v<_Ty2, _Ty>) optional(_Ty2&& _Right) : _Mybase(in_place, _STD forward<_Ty2>(_Right)) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_convertible<_Ty2, _Ty>>, int> = 0> - constexpr optional(_Ty2&& _Right) : _Mybase(in_place, _STD forward<_Ty2>(_Right)) {} - template , negation>>, int> = 0> - constexpr explicit optional(_Ty2&& _Right) : _Mybase(in_place, _STD forward<_Ty2>(_Right)) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ template struct _AllowUnwrapping : bool_constant, is_constructible<_Ty, optional<_Ty2>&>, @@ -252,7 +243,6 @@ public: is_convertible&, _Ty>, is_convertible&, _Ty>, is_convertible, _Ty>, is_convertible, _Ty>>> {}; -#if _HAS_CONDITIONAL_EXPLICIT template , is_constructible<_Ty, const _Ty2&>>, int> = 0> _CONSTEXPR20 explicit(!is_convertible_v) optional(const optional<_Ty2>& _Right) { @@ -260,50 +250,13 @@ public: this->_Construct(*_Right); } } -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_constructible<_Ty, const _Ty2&>, - is_convertible>, - int> = 0> - optional(const optional<_Ty2>& _Right) { - if (_Right) { - this->_Construct(*_Right); - } - } - template , is_constructible<_Ty, const _Ty2&>, - negation>>, - int> = 0> - explicit optional(const optional<_Ty2>& _Right) { - if (_Right) { - this->_Construct(*_Right); - } - } -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT template , is_constructible<_Ty, _Ty2>>, int> = 0> _CONSTEXPR20 explicit(!is_convertible_v<_Ty2, _Ty>) optional(optional<_Ty2>&& _Right) { if (_Right) { this->_Construct(_STD move(*_Right)); } } -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_constructible<_Ty, _Ty2>, is_convertible<_Ty2, _Ty>>, - int> = 0> - optional(optional<_Ty2>&& _Right) { - if (_Right) { - this->_Construct(_STD move(*_Right)); - } - } - template , is_constructible<_Ty, _Ty2>, - negation>>, - int> = 0> - explicit optional(optional<_Ty2>&& _Right) { - if (_Right) { - this->_Construct(_STD move(*_Right)); - } - } -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ #if _HAS_CXX23 template diff --git a/stl/inc/tuple b/stl/inc/tuple index 948d65ffa64..3d218f93cba 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -22,7 +22,6 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN -#if _HAS_CONDITIONAL_EXPLICIT template _INLINE_VAR constexpr bool _Tuple_conditional_explicit_v0 = false; @@ -33,31 +32,6 @@ _INLINE_VAR constexpr bool _Tuple_conditional_explicit_v0 template _INLINE_VAR constexpr bool _Tuple_conditional_explicit_v = _Tuple_conditional_explicit_v0 == sizeof...(_Srcs), _Dest, _Srcs...>; -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv -// Constrain tuple's implicit constructors -template -_INLINE_VAR constexpr bool _Tuple_implicit_v0 = false; - -template -_INLINE_VAR constexpr bool _Tuple_implicit_v0, _Srcs...> = - conjunction_v..., is_convertible<_Srcs, _Dests>...>; - -template -struct _Tuple_implicit_val - : bool_constant<_Tuple_implicit_v0 == sizeof...(_Srcs), _Dest, _Srcs...>> {}; - -// Constrain tuple's explicit constructors -template -_INLINE_VAR constexpr bool _Tuple_explicit_v0 = false; - -template -_INLINE_VAR constexpr bool _Tuple_explicit_v0, _Srcs...> = - conjunction_v..., negation...>>>; - -template -struct _Tuple_explicit_val - : bool_constant<_Tuple_explicit_v0 == sizeof...(_Srcs), _Dest, _Srcs...>> {}; -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ template _INLINE_VAR constexpr bool _Tuple_constructible_v0 = false; @@ -287,7 +261,6 @@ public: : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD forward<_Tpl>(_Right), make_index_sequence>>{}) {} -#if _HAS_CONDITIONAL_EXPLICIT template , _STD is_default_constructible<_Rest>...>, int> = 0> @@ -296,48 +269,13 @@ public: tuple() noexcept(conjunction_v, is_nothrow_default_constructible<_Rest>...>) // strengthened : _Mybase(), _Myfirst() {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_default_constructible<_Rest>..., - _Is_implicitly_default_constructible<_This2>, _Is_implicitly_default_constructible<_Rest>...>, - int> = 0> - constexpr tuple() noexcept(conjunction_v, - is_nothrow_default_constructible<_Rest>...>) // strengthened - : _Mybase(), _Myfirst() {} - - template , is_default_constructible<_Rest>..., - negation, - _Is_implicitly_default_constructible<_Rest>...>>>, - int> = 0> - constexpr explicit tuple() noexcept(conjunction_v, - is_nothrow_default_constructible<_Rest>...>) // strengthened - : _Mybase(), _Myfirst() {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT template , int> = 0> constexpr explicit(_Tuple_conditional_explicit_v) tuple( const _This& _This_arg, const _Rest&... _Rest_arg) noexcept(conjunction_v, is_nothrow_copy_constructible<_Rest>...>) // strengthened : tuple(_Exact_args_t{}, _This_arg, _Rest_arg...) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template ::value, int> = 0> - constexpr tuple(const _This& _This_arg, const _Rest&... _Rest_arg) noexcept( - conjunction_v, - is_nothrow_copy_constructible<_Rest>...>) // strengthened - : tuple(_Exact_args_t{}, _This_arg, _Rest_arg...) {} - - template ::value, int> = 0> - constexpr explicit tuple(const _This& _This_arg, const _Rest&... _Rest_arg) noexcept( - conjunction_v, - is_nothrow_copy_constructible<_Rest>...>) // strengthened - : tuple(_Exact_args_t{}, _This_arg, _Rest_arg...) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT template , _STD _Tuple_constructible_val>, @@ -345,23 +283,6 @@ public: constexpr explicit(_Tuple_conditional_explicit_v) tuple(_This2&& _This_arg, _Rest2&&... _Rest_arg) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Exact_args_t{}, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , _Tuple_implicit_val>, - int> = 0> - constexpr tuple(_This2&& _This_arg, _Rest2&&... _Rest_arg) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Exact_args_t{}, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} - - template , _Tuple_explicit_val>, - int> = 0> - constexpr explicit tuple(_This2&& _This_arg, _Rest2&&... _Rest_arg) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Exact_args_t{}, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ tuple(const tuple&) = default; tuple(tuple&&) = default; @@ -375,7 +296,6 @@ public: : tuple(_Unpack_tuple_t{}, _Right) {} #endif // _HAS_CXX23 -#if _HAS_CONDITIONAL_EXPLICIT template , _STD _Tuple_convert_val&, _Other...>>, int> = 0> @@ -383,44 +303,13 @@ public: tuple(const tuple<_Other...>& _Right) noexcept( _Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _Right) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , - _Tuple_convert_val&, _Other...>>, - int> = 0> - constexpr tuple(const tuple<_Other...>& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _Right) {} - template , - _Tuple_convert_val&, _Other...>>, - int> = 0> - constexpr explicit tuple(const tuple<_Other...>& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _Right) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ - -#if _HAS_CONDITIONAL_EXPLICIT template , _STD _Tuple_convert_val, _Other...>>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v) tuple(tuple<_Other...>&& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , - _Tuple_convert_val, _Other...>>, - int> = 0> - constexpr tuple(tuple<_Other...>&& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} - - template , - _Tuple_convert_val, _Other...>>, - int> = 0> - constexpr explicit tuple(tuple<_Other...>&& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ #if _HAS_CXX23 template , @@ -438,43 +327,17 @@ public: : tuple(_Unpack_tuple_t{}, _Right) {} #endif // _HAS_CXX23 -#if _HAS_CONDITIONAL_EXPLICIT template , int> = 0> constexpr explicit(_Tuple_conditional_explicit_v) tuple(const pair<_First, _Second>& _Right) noexcept( _Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _Right) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template ::value, int> = 0> - constexpr tuple(const pair<_First, _Second>& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _Right) {} - template ::value, int> = 0> - constexpr explicit tuple(const pair<_First, _Second>& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _Right) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ - -#if _HAS_CONDITIONAL_EXPLICIT template , int> = 0> constexpr explicit(_Tuple_conditional_explicit_v) tuple( pair<_First, _Second>&& _Right) noexcept(_Tuple_nothrow_constructible_v) // strengthened : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template ::value, int> = 0> - constexpr tuple(pair<_First, _Second>&& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} - - template ::value, int> = 0> - constexpr explicit tuple(pair<_First, _Second>&& _Right) noexcept( - _Tuple_nothrow_constructible_v) // strengthened - : tuple(_Unpack_tuple_t{}, _STD move(_Right)) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ #if _HAS_CXX23 template , _STD is_default_constructible<_Rest>...>, int> = 0> @@ -493,42 +355,13 @@ public: !conjunction_v<_Is_implicitly_default_constructible<_This2>, _Is_implicitly_default_constructible<_Rest>...>) tuple(allocator_arg_t, const _Alloc& _Al) : _Mybase(allocator_arg, _Al), _Myfirst(_Al, allocator_arg) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_default_constructible<_Rest>..., - _Is_implicitly_default_constructible<_This2>, _Is_implicitly_default_constructible<_Rest>...>, - int> = 0> - _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc& _Al) - : _Mybase(allocator_arg, _Al), _Myfirst(_Al, allocator_arg) {} - template , is_default_constructible<_Rest>..., - negation, - _Is_implicitly_default_constructible<_Rest>...>>>, - int> = 0> - _CONSTEXPR20 explicit tuple(allocator_arg_t, const _Alloc& _Al) - : _Mybase(allocator_arg, _Al), _Myfirst(_Al, allocator_arg) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ - -#if _HAS_CONDITIONAL_EXPLICIT template , int> = 0> _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, const _This& _This_arg, const _Rest&... _Rest_arg) : tuple(_Alloc_exact_args_t{}, _Al, _This_arg, _Rest_arg...) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template ::value, int> = 0> - _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc& _Al, const _This& _This_arg, const _Rest&... _Rest_arg) - : tuple(_Alloc_exact_args_t{}, _Al, _This_arg, _Rest_arg...) {} - - template ::value, int> = 0> - _CONSTEXPR20 explicit tuple(allocator_arg_t, const _Alloc& _Al, const _This& _This_arg, const _Rest&... _Rest_arg) - : tuple(_Alloc_exact_args_t{}, _Al, _This_arg, _Rest_arg...) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT template , _STD _Tuple_constructible_val>, @@ -536,21 +369,6 @@ public: _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, _This2&& _This_arg, _Rest2&&... _Rest_arg) : tuple(_Alloc_exact_args_t{}, _Al, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , _Tuple_implicit_val>, - int> = 0> - _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc& _Al, _This2&& _This_arg, _Rest2&&... _Rest_arg) - : tuple(_Alloc_exact_args_t{}, _Al, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} - - template , _Tuple_explicit_val>, - int> = 0> - _CONSTEXPR20 explicit tuple(allocator_arg_t, const _Alloc& _Al, _This2&& _This_arg, _Rest2&&... _Rest_arg) - : tuple(_Alloc_exact_args_t{}, _Al, _STD forward<_This2>(_This_arg), _STD forward<_Rest2>(_Rest_arg)...) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ template , int> = 0> @@ -571,7 +389,6 @@ public: : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} #endif // _HAS_CXX23 -#if _HAS_CONDITIONAL_EXPLICIT template , _STD _Tuple_convert_val&, _Other...>>, @@ -579,23 +396,7 @@ public: _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, const tuple<_Other...>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , - _Tuple_convert_val&, _Other...>>, - int> = 0> - _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc& _Al, const tuple<_Other...>& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} - - template , - _Tuple_convert_val&, _Other...>>, - int> = 0> - _CONSTEXPR20 explicit tuple(allocator_arg_t, const _Alloc& _Al, const tuple<_Other...>& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT template , _STD _Tuple_convert_val, _Other...>>, @@ -603,21 +404,6 @@ public: _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, tuple<_Other...>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , - _Tuple_convert_val, _Other...>>, - int> = 0> - _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc& _Al, tuple<_Other...>&& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} - - template , - _Tuple_convert_val, _Other...>>, - int> = 0> - _CONSTEXPR20 explicit tuple(allocator_arg_t, const _Alloc& _Al, tuple<_Other...>&& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ #if _HAS_CXX23 template , int> = 0> _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, const pair<_First, _Second>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template ::value, int> = 0> - _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc& _Al, const pair<_First, _Second>& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} - - template ::value, int> = 0> - _CONSTEXPR20 explicit tuple(allocator_arg_t, const _Alloc& _Al, const pair<_First, _Second>& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT template , int> = 0> _CONSTEXPR20 explicit(_Tuple_conditional_explicit_v) tuple(allocator_arg_t, const _Alloc& _Al, pair<_First, _Second>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template ::value, int> = 0> - _CONSTEXPR20 tuple(allocator_arg_t, const _Alloc& _Al, pair<_First, _Second>&& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} - - template ::value, int> = 0> - _CONSTEXPR20 explicit tuple(allocator_arg_t, const _Alloc& _Al, pair<_First, _Second>&& _Right) - : tuple(_Alloc_unpack_tuple_t{}, _Al, _STD move(_Right)) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ #if _HAS_CXX23 template , is_default_constructible<_Uty2>>, int> = 0> constexpr explicit( @@ -153,52 +152,14 @@ struct pair { // store a pair of values pair() noexcept( is_nothrow_default_constructible_v<_Uty1>&& is_nothrow_default_constructible_v<_Uty2>) // strengthened : first(), second() {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_default_constructible<_Uty2>, - _Is_implicitly_default_constructible<_Uty1>, _Is_implicitly_default_constructible<_Uty2>>, - int> = 0> - constexpr pair() noexcept( - is_nothrow_default_constructible_v<_Uty1>&& is_nothrow_default_constructible_v<_Uty2>) // strengthened - : first(), second() {} - template , is_default_constructible<_Uty2>, - negation, - _Is_implicitly_default_constructible<_Uty2>>>>, - int> = 0> - constexpr explicit pair() noexcept( - is_nothrow_default_constructible_v<_Uty1>&& is_nothrow_default_constructible_v<_Uty2>) // strengthened - : first(), second() {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ - -#if _HAS_CONDITIONAL_EXPLICIT template , is_copy_constructible<_Uty2>>, int> = 0> constexpr explicit(!conjunction_v, is_convertible>) pair(const _Ty1& _Val1, const _Ty2& _Val2) noexcept( is_nothrow_copy_constructible_v<_Uty1>&& is_nothrow_copy_constructible_v<_Uty2>) // strengthened : first(_Val1), second(_Val2) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_copy_constructible<_Uty2>, - is_convertible, is_convertible>, - int> = 0> - constexpr pair(const _Ty1& _Val1, const _Ty2& _Val2) noexcept( - is_nothrow_copy_constructible_v<_Uty1>&& is_nothrow_copy_constructible_v<_Uty2>) // strengthened - : first(_Val1), second(_Val2) {} - - template , is_copy_constructible<_Uty2>, - negation, is_convertible>>>, - int> = 0> - constexpr explicit pair(const _Ty1& _Val1, const _Ty2& _Val2) noexcept( - is_nothrow_copy_constructible_v<_Uty1>&& is_nothrow_copy_constructible_v<_Uty2>) // strengthened - : first(_Val1), second(_Val2) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT #if _HAS_CXX23 template && is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened : first(_STD forward<_Other1>(_Val1)), second(_STD forward<_Other2>(_Val2)) { } -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_constructible<_Ty2, _Other2>, - is_convertible<_Other1, _Ty1>, is_convertible<_Other2, _Ty2>>, - int> = 0> - constexpr pair(_Other1&& _Val1, _Other2&& _Val2) noexcept( - is_nothrow_constructible_v<_Ty1, _Other1>&& is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened - : first(_STD forward<_Other1>(_Val1)), second(_STD forward<_Other2>(_Val2)) {} - - template , is_constructible<_Ty2, _Other2>, - negation, is_convertible<_Other2, _Ty2>>>>, - int> = 0> - constexpr explicit pair(_Other1&& _Val1, _Other2&& _Val2) noexcept( - is_nothrow_constructible_v<_Ty1, _Other1>&& is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened - : first(_STD forward<_Other1>(_Val1)), second(_STD forward<_Other2>(_Val2)) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ pair(const pair&) = default; pair(pair&&) = default; @@ -240,7 +184,6 @@ struct pair { // store a pair of values : first(_Right.first), second(_Right.second) {} #endif // _HAS_CXX23 -#if _HAS_CONDITIONAL_EXPLICIT template , is_constructible<_Ty2, const _Other2&>>, int> = 0> @@ -248,50 +191,13 @@ struct pair { // store a pair of values pair(const pair<_Other1, _Other2>& _Right) noexcept(is_nothrow_constructible_v<_Ty1, const _Other1&>&& is_nothrow_constructible_v<_Ty2, const _Other2&>) // strengthened : first(_Right.first), second(_Right.second) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_constructible<_Ty2, const _Other2&>, - is_convertible, is_convertible>, - int> = 0> - constexpr pair(const pair<_Other1, _Other2>& _Right) noexcept(is_nothrow_constructible_v<_Ty1, const _Other1&>&& - is_nothrow_constructible_v<_Ty2, const _Other2&>) // strengthened - : first(_Right.first), second(_Right.second) {} - - template , is_constructible<_Ty2, const _Other2&>, - negation, is_convertible>>>, - int> = 0> - constexpr explicit pair(const pair<_Other1, _Other2>& _Right) noexcept( - is_nothrow_constructible_v<_Ty1, const _Other1&>&& - is_nothrow_constructible_v<_Ty2, const _Other2&>) // strengthened - : first(_Right.first), second(_Right.second) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ -#if _HAS_CONDITIONAL_EXPLICIT template , is_constructible<_Ty2, _Other2>>, int> = 0> constexpr explicit(!conjunction_v, is_convertible<_Other2, _Ty2>>) pair(pair<_Other1, _Other2>&& _Right) noexcept( is_nothrow_constructible_v<_Ty1, _Other1>&& is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened : first(_STD forward<_Other1>(_Right.first)), second(_STD forward<_Other2>(_Right.second)) {} -#else // ^^^ _HAS_CONDITIONAL_EXPLICIT ^^^ / vvv !_HAS_CONDITIONAL_EXPLICIT vvv - template , is_constructible<_Ty2, _Other2>, - is_convertible<_Other1, _Ty1>, is_convertible<_Other2, _Ty2>>, - int> = 0> - constexpr pair(pair<_Other1, _Other2>&& _Right) noexcept( - is_nothrow_constructible_v<_Ty1, _Other1>&& is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened - : first(_STD forward<_Other1>(_Right.first)), second(_STD forward<_Other2>(_Right.second)) {} - - template , is_constructible<_Ty2, _Other2>, - negation, is_convertible<_Other2, _Ty2>>>>, - int> = 0> - constexpr explicit pair(pair<_Other1, _Other2>&& _Right) noexcept( - is_nothrow_constructible_v<_Ty1, _Other1>&& is_nothrow_constructible_v<_Ty2, _Other2>) // strengthened - : first(_STD forward<_Other1>(_Right.first)), second(_STD forward<_Other2>(_Right.second)) {} -#endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ #if _HAS_CXX23 template )' in C++17 and earlier is a vendor extension -#if !_HAS_CXX20 && _HAS_CONDITIONAL_EXPLICIT +#if !_HAS_CXX20 #define _STL_DISABLED_WARNING_C5053 5053 -#else // !_HAS_CXX20 && _HAS_CONDITIONAL_EXPLICIT +#else // !_HAS_CXX20 #define _STL_DISABLED_WARNING_C5053 -#endif // !_HAS_CXX20 && _HAS_CONDITIONAL_EXPLICIT +#endif // !_HAS_CXX20 #ifndef _STL_EXTRA_DISABLED_WARNINGS #define _STL_EXTRA_DISABLED_WARNINGS