Consider the following default default constructor code std::pair
from the STL implementation that ships with Microsoft Visual Studio 15.4.5:
template<class _Uty1 = _Ty1,
class _Uty2 = _Ty2,
class = enable_if_t<is_default_constructible<_Uty1>::value
&& is_default_constructible<_Uty2>::value>>
constexpr pair()
: first(), second()
{
}
I set the parameter /std:c++latest
, so according to the standard (I am using the n4659 project here), I expect this constructor to be excluded from overload resolution if either _Ty1
or is _Ty1
not constructive by default:
23.4.2 Pair of pattern template [par.]
EXPLICIT constexpr pair ();
Effects: the value initializes the first and second.
: is_default_constructible_v<first_type>
is_default_constructible_v<second_type>
. [: .]
:
class = enable_if_t<is_default_constructible<_Uty1>::value
&& is_default_constructible<_Uty2>::value>
, SFINAE .
, Microsoft Visual Studio 15.5.3 " " ( "" ):
template<class _Uty1 = _Ty1,
class _Uty2 = _Ty2,
enable_if_t<conjunction_v<
is_default_constructible<_Uty1>,
is_default_constructible<_Uty2>
>, int> = 0>
constexpr pair()
: first(), second()
{
}
, , , , , .