A
ales.pergl
When I have multiple nested classes, I find it unnecessarily verbose to spell out the fully qualified name of the most nested class when defining its members.
So I'm looking for a way to define an alias for the fully qualified class name. Like this:
// in header
class A {
class B {
class C {
void DoStuff();
};
};
};
// in cpp
typedef A::B::C C; // error, A::B::C is inacessible in this context
void C:
oStuff() {} // would love to be able to shorten the class name
The problem is, the above doesn't compile, because C is not accessible from global scope. The easiest workaround is to define a macro instead of a typedef:
#define C A::B::C
Does anybody know of a better way, without using the preprocessor?
Thanks.
So I'm looking for a way to define an alias for the fully qualified class name. Like this:
// in header
class A {
class B {
class C {
void DoStuff();
};
};
};
// in cpp
typedef A::B::C C; // error, A::B::C is inacessible in this context
void C:
The problem is, the above doesn't compile, because C is not accessible from global scope. The easiest workaround is to define a macro instead of a typedef:
#define C A::B::C
Does anybody know of a better way, without using the preprocessor?
Thanks.