I want to have a template for selecting by numeric types, but also want to have a global type template. I tried to apply a solution for this question, but this did not work:
template<typename T, typename ... Types>
void myFct(T arg1, Types ... rest) { }
template<typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type,
typename ... Types>
void myFct(T arg1, Types ... rest) { }
because now I have two functions with the same header. What is the right way to do something like:
template<typename T, typename ... Types>
void myFct(T arg1, Types ... rest)
{
if (isNumeric(T))
doNumericStuff();
else
doStuff();
}
source
share