If a private c++ method is implemented inside a .cpp compilation unit (not implemented in the class definition, nor declared as inline), is it possible for the compiler to automatically inline it anyway since it is only used inside the one .cpp compilation unit?
Example:
MyClass.h:
class MyClass
{
public:
void foo();
private:
void bar();
}
MyClass.cpp:
void MyClass::foo()
{
bar(); //can the compiler choose to inline this call?
}
void MyClass::bar()
{
printf("bar called\n");
}