Consider the following code:
#include <list>
namespace foo {
class FooMember {
public:
long member;
};
class BarMember {
public:
std::list<FooMember> doSomething();
FooMember doSomethingDifferent();
};
}
Create Implementation for doSomething() will create the following code:
std::list<FooMember> foo::BarMember::doSomething()
{
}
If the implementation is outside of the header (in a cpp file), this will not compile due to the missing namespace foo in the return value.
doSomethingDifferent() is encapsulated correctly though, so the problem occurs only if the return value is a template typed to a namespace member.
I realize that some developers will put a "using namespace foo" in the namespace, however, in large projects with many namespace it is strongly discouraged to use "using namespace".
F.