Are methods of templated classes implied inline linkage (not talking about the inline optimization), or is it just templated methods which are?
// A.h
template<typename T>
class A
{
public:
void func1(); // #1
virtual void func2(); // #2
template<typename T2> void func3(); // #3
};
template<typename T>
void A<T>::func1(){} // #1
template<typename T>
void A<T>::func2(){} // #2
template<typename T>
template<typename T2>
void A<T>::func3<T2>(){} // #3
Are all the above cases inline [linkage]? (Should I explicitly write inline for any of them)?
inlinefor all of them if they are all in the header file. - jxhinline, and let the compiler (who is smarter than you) make the decision to inline or not. - Jonathon Reinhartinlineor not. Linkage affects whether the symbols are exported in the translation unit or not, andinlinefunctions (potentially, that is if it is notstaticand the function is generated out-of-line in the translation unit) are exported. Try taking the address of an inline function in two translation units (this will force an out-of-line definition, in case your compiler does not do that by default), then check what symbols are exported in the binary file and you will see that inline function. - David Rodríguez - dribeas