Adding a new member (even a whole namespace) to an already existing namespace alias

  alias, c++, namespaces

Let library be a namespace from an external source (e.g. shared library). Let global be a global namespace for a project that uses that external source.

By using

namepace global
{
    namespace external = library;
}

the library namespace can now be used by accessing global::external. Now imaging other_library (with no conflicts with library) being a namespace from a second external source. Is it possible to add other_library to the alias external so that functionality from both external sources can be access via global::external?

Reason: provide a unified access to different resources by hiding underlying namespaces and grouping those into a different, custom API-friendly way.

Source: Windows Questions C++

LEAVE A COMMENT