The first call of function f<int>()
will instantiate function f
for template parameter int
, call f<char>()
instantiates function f
for template parameter char
- these are two different functions that have nothing in common, and static variables for them also live their own lives.
The second call f<int>()
accesses a previously instantiated function with the initialized value of a static variable.
Login in to like
Login in to comment