Is there a practical difference between the following two ways to specialize/overload f
? Note the difference in the lines above the specialized/overloaded f
.
template <typename T>
T f(T x) {
return x;
}
template<>
int f(int x) {
return x + 1;
}
and
template <typename T>
T f(T x) {
return x;
}
int f(int x) {
return x + 1;
}