When I'm writing a simple (non-template) class, if the function implementation is provided "right in place", it's automatically treated as inline
.
class A {
void InlinedFunction() { int a = 0; }
// ^^^^ the same as 'inline void InlinedFunction'
}
What about this rule when talking about template-based classes?
template <typename T> class B {
void DontKnowFunction() { T a = 0; }
// Will this function be treated as inline when the compiler
// instantiates the template?
};
Also, how is the inline
rule applied to non-nested template functions, like
template <typename T> void B::DontKnowFunction() { T a = 0; }
template <typename T> inline void B::DontKnowFunction() { T a = 0; }
What would happen in the first and in the second case here?
Thank you.