I assume this is your first use of templates, so I will try to be didactic.
. , , . , , : , .
:
template <class T>
void foo(T t) { std::cout << t << "\n"; }
, - .
int i;
foo(i);
template. , , T int.
double d;
foo(d); // Another instantiation, this time with `T` replaced by `double`
foo(d); // foo<double>() already exists, it reused
. , , .
, 2 :
2 .
(1) . , . , ( , , )
(2) . :
- (
template <> void foo<int>();), , - ,
, , , .
gcc , .
, , . , , , ODR: . , , , ( ). , , , .