Given the following
template <typename T, typename Enable=void>
struct test{}
template <typename T,
typename std::enable_if< some_trait<T>::value >::type >
struct test{}
assuming some_trait::value is true, enable_if::type is void. However, my query is related to the selection when the follow is the case.
template <typename T,
typename std::enable_if_t< some_trait<T>::value,T>::type >
struct test{}
When a second template parameter for enable_if is provided for ::type, and it does not match the default value in the unspecailized template, the unspecialized template is selected.
My question is where in the standard is the ordering described for which template is chosen, and why is the instanciation test with the default considered as a better match then test, with the second T from enable_if::type.
Aucun commentaire:
Enregistrer un commentaire