Namespace Alias โ€‹โ€‹Issues

I have a header file in which I want to use a namespace alias when defining a class. However, I do not want to disclose this alias to anything that includes the header file.

// foo.h namespace qux = boost::std::bar::baz::qux; // ! exposed to the world class foo { // can't put a namespace alias here // stuff using qux:: }; 

How can I use a namespace alias to declare a class without leaking it around the world?

+6
source share
1 answer
 namespace MyClassSpace { namespace qux = boost::std::bar::baz::qux; class foo { // use qux:: }; } using MyClassSpace::foo; // lift 'foo' into the enclosing namespace 

Just like most Boost libraries do, put all of their materials in a separate namespace and raise important identifiers in the boost namespace.

+12
source

Source: https://habr.com/ru/post/892177/


All Articles