I have a class that I would like to reference in my header file, which is in a long chain of nested namespaces: MySpaceA::MySpaceB::MySpaceC::MySpaceD::MyVeryLongNamedClass. I would like to use it under a different name, but not MyVeryLongNamedClass — something shorter and more useful, like MyClass.
I could put using MySpaceA::MySpaceB::MySpaceC::MySpaceD in my header, but I do not want to import the whole namespace. I would prefer to have some kind of construction like
using MyClass = MySpaceA::MySpaceB::MySpaceC::MySpaceD::MyVeryLongNamedClass
I know this is possible with name spaces, but I cannot seem to get it to work with classes.
Thank you very much for your help.
For templates, you could use a template typedef:
Now you can refer to
MyClass<T>::typeinstead ofMySpaceA::MySpaceB::MySpaceC::MySpaceD::MyVeryLongNamedClass<T>.