I want to shorten a namespace for use within MyClass, for example by using namespace or defining an alias:
namespace foo = really::loong::name::space;
class MyClass {
private:
foo::FooClass f;
// ...
};
However, this pollutes the global namespace and risks affecting code elsewhere. I could wrap the above code within a name space, but I'm quite happy with the name MyClass and I'd rather not have to refer to it as mynamespace::MyClass. Is there any way around this?
Put the class in a namespace anyway so it doesn't pollute the global namepsace either. If your users prefer short names, they can add a
using mynamespace::MyClass.