lundi 14 décembre 2020

Question about enable_if to filter out the argument with the type of `char*`

Why char* pstr="hello"; pushArg(pstr); still invoke such template?

You see there is &&(!std::is_same<char, typename std::remove_cv_t<std::remove_pointer_t<T>>>::value) already.

template <typename T, 
          typename std::enable_if<(!std::is_same<lua_CFunction, T*>::value)
                               &&   std::is_pointer<T>::value
                               && (!std::is_same<std::string*, T>::value)
                               && (!std::is_same<char, typename std::remove_cv_t<std::remove_pointer_t<T>>>::value)
                               && (!std::is_same<unsigned char, typename std::remove_cv_t<std::remove_pointer_t<T>>>::value)
int pushArg(T& val)
{

}   

Aucun commentaire:

Enregistrer un commentaire