C++ Language/Templates/TemplatedFunctions

A templated-function looks like any ordinary function, but with "template-parameter" placeholders for some types: template<typename T> T ComputeMin(T x, T y) { return (x < y) ? x : y; }. No compilation happens here where this templated-function is being defined; instead, this ComputeMin<>() will get compiled (with "specialization" T=int applied) during the first occurrence of that usage, as in int iResult = ComputeMin<int>(3,4);. In this case, you could have simply written int iResult = ComputeMin(3,4);, since the compiler could infer T=int from those parameter types.

Additional information about templated-functions (includes interactive examples)