Is there a conceptual (or other) difference between specializing function template and using if constexpr
?
E.g.:
template<class T>
void fun(T t)
{
// Generic code.
}
template<>
void fun(int t)
{
// int code.
}
Vs.
template<class T>
void fun(T t)
{
if constexpr(std::is_same_v<T, int>)
{
// int code.
}
else
{
// Generic code.
}
}