I know what templates in C ++ do, but today I saw some strange piece of code:
template <> void swap(foo &a, foo &b) { a.name = b.name; a.id = 1;
I did a little research and found out that it is called a specialized template or something similar.
If in the above code I remove the template <> , I get exactly the same results. There are also no generic types, for example, in the regular template function ...
My question is: what is the purpose of using them?
source share