In C++ Primer Plus (2001, Czech Translation) I have found these different template specialization syntax:
function template
template <typename T> void foo(T);
specialization syntax
void foo(int param); // 1
void foo<int>(int param); // 2
template <> void foo<int>(int param); // 3
template <> void foo(int param); // 4
template void foo(int param); // 5
Googling a bit, I have found only No.3 examples. Is there any difference (in call, compiling, usage) among them? Are some of them obsolete/deprecated? Why not just use No.1?
Using Visual Studio 2012, it seems to work slightly different if there's no function argument:
Here are comments with each syntax:
Added by me:
From coding point of view, overload is preferred over function-template-specialization.
So, don't specialize function template:
And to know the terminologies:
See this :