If I have a member function template in a class without a template and you want to define it outside the class, do I need to use the "built-in"?
Example:
class A { template <class D> void someMethod(D param); } template <class D> /* inline needed here? */ void A::someMethod(D param) { }
Section 3.2.5 of the standard states that function templates are not subject to the One Definition rule. Is a member function template a function template in this regard?
Edit: The linker doesn't complain without the built-in - but still - is it really C ++ 03?
Edit:
What I have learned so far: gcc (and presumably other compilers too) exports implicit template instances as weak characters, i.e. a conflict will not occur during the link if they are created in several translation units. Since weak characters are not part of the standard - does the standard somehow implicitly require template instances to act this way, and can I expect the same behavior with other standard compiler / linker combinations?
Since inline is mostly ignored for optimization, but allows many definitions of functions in different translation units, this implicitly translates these functions into export as weak characters. Does this template declaration mean the inline is redundant?
source share