Why the second function can't match the template in the class definition??
Class C {
template <typename T, typename T2 = T>
T val() const;
};
template <>
std::string C::val() const {
//OK
}
template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type>
T C::val() const {
//Not OK
}
EDIT: This is an overview of what I want to achieve. Basically I'm writing a function to parse and return an object based on the template type. I have some defined classes of my own, that is I have to parse with respect to their members. I also need to parse numerical types and to strings. So I wrote a specialized version for every of my defined classes. A version that parses to numerical types and return the given type (of course I have to make sure that the given type is numerical, hence the enable if)