Is it possible to have a namespace that has all the declarations of more than one other namespace? Like this:
namespace std {...}; namespace glm {...}; namespace mynamespace = std; //mynamespace is an alias for std namespace mynamespace += glm; //mynamespace will hold glm functions as well.
C++ Namespaces Namespace alias A namespace can be given an alias (i.e., another name for the same namespace) using the namespace identifier = syntax. Members of the aliased namespace can be accessed by qualifying them with the name of the alias.
You can also create an alias for a namespace or a type with a using alias directive.
In the first use case, you define a scope, at the end of which an object is disposed. In the second use case, you create an alias for a namespace or import specific types from other namespaces. In the third use case, you import members of a single class with the static directive.
The using namespace statement just means that in the scope it is present, make all the things under the std namespace available without having to prefix std:: before each of them.
Sure
namespace mynamespace { using namespace std; using namespace glm; }
You can use using
to achieve this:
namespace mynamespace { using namespace std; using namespace glm; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With