When you write a template function (or member) you have to write the body in the header file. This makes perfect sense since templates are essentially instructions to the compiler how to make functions on the fly based on a type unknown until the initialization.
My question is connected to the one definition rule, if I initialize a template with the same type (for example typename T becomes int) in two different files and I link them together I do not have a multiple definition error.
What is the reason? Are template functions implicitly static and so not visible outside their compilation unit?
Or there is another reason?
Answer: No. They aren't. They are an exception to the one definition rule.
inline.f<int>share the same block-local static variables.)