I can't find clear answer about this (apparently) simple case. Assume the following example:
Declaration:
class Foo {
// blah blah
Foo& copy(const Foo& other);
Foo& operator=(const Foo& other);
};
Definition:
inline Foo& Foo::copy(const Foo& other) {
data_ = other._data;
return *this;
}
Foo& Foo::operator=(const Foo& other) {
return copy(other);
}
As you see, I stated the copy()
method as inline then I use it in the operator=
method. The question is: Does this inline actually have an effect, or the compiler ignore it ?