1.4 KiB
[temp.fct.spec.general]
13 Templates [temp]
13.10 Function template specializations [temp.fct.spec]
13.10.1 General [temp.fct.spec.general]
A function instantiated from a function template is called a function template specialization; so is an explicit specialization of a function template.
Template arguments can be explicitly specified when naming the function template specialization, deduced from the context (e.g., deduced from the function arguments in a call to the function template specialization, see [temp.deduct]), or obtained from default template arguments.
Each function template specialization instantiated from a template has its own copy of any static variable.
[Example 1: template void f(T* p) {static T s;};
void g(int a, char* b) { f(&a); // calls f(int*) f(&b); // calls f<char*>(char**)}
Heref(int*) has a static variables of typeint andf<char*>(char**) has a static variables of typechar*.
â end example]