template<class _Other1,
class _Other2,
class = enable_if_t<is_constructible<_Ty1, _Other1>::value
&& is_constructible<_Ty2, _Other2>::value>,
enable_if_t<is_convertible<_Other1, _Ty1>::value
&& is_convertible<_Other2, _Ty2>::value, int> = 0>
constexpr pair(pair<_Other1, _Other2>&& _Right)
_NOEXCEPT_OP((is_nothrow_constructible<_Ty1, _Other1>::value
&& is_nothrow_constructible<_Ty2, _Other2>::value))
: first(_STD forward<_Other1>(_Right.first)),
second(_STD forward<_Other2>(_Right.second))
{ // construct from moved compatible pair
}
template<class _Other1,
class _Other2,
class = enable_if_t<is_constructible<_Ty1, _Other1>::value
&& is_constructible<_Ty2, _Other2>::value>,
enable_if_t<!is_convertible<_Other1, _Ty1>::value
|| !is_convertible<_Other2, _Ty2>::value, int> = 0>
constexpr explicit pair(pair<_Other1, _Other2>&& _Right)
_NOEXCEPT_OP((is_nothrow_constructible<_Ty1, _Other1>::value
&& is_nothrow_constructible<_Ty2, _Other2>::value))
: first(_STD forward<_Other1>(_Right.first)),
second(_STD forward<_Other2>(_Right.second))
{ // construct from moved compatible pair
}
utilitaire fichier pour VS 2017 ligne 206, _Other1 et _Other2 sont des paramètres, c'est std :: paire construction » de Func, et nous utilisons Autres1 et Autres2 à initialiser "premier" et "deuxième",
Je pense que is_constructible est assez, pourquoi utilisons-nous is_convertible ici?
et en passant, quelle est la différence entre class = enable_if_t< ... ::value>
et enable_if_t< ... ::value,int> = 0
?Pourquoi 'is_convertible' ici <utility> std :: pair (STL)?
Ceci est de mettre en œuvre [\ [paires.pair \]/12] (http://eel.is/c++draft/pairs.pair#12.sentence-2). – cpplearner