In C++, I can define a class within another class the declares member functions. Later, when I am defining the definition for those declarations, is there a way to not keep repeating the containing class. For example, my header might look like this:
class Outer {
class Inner {
void one();
void two();
void three();
};
};
And then later, my definitions might look like this:
void Outer::Inner::one() { ... }
void Outer::Inner::two() { ... }
void Outer::Inner::three() { ... }
Is there some way the Outer may be omitted without defining at the point of declaration, perhaps through use of namespaces to become:
void Inner::one() { ... }
void Inner::two() { ... }
void Inner::three() { ... }
I haven’t tried this (no compiler here) specifically, but I would hazard a guess that if you’re working with an inner class, like ::iterator, you could probably do:
and then do:
assuming there isn’t a global with the same name as your inner class in the outer class’s scope.
Also, you could definitely use a macro, and could possibly use a typedef (not sure, but worth a try).
I’d say all this makes your code less readable and it’s a bad idea though regardless of how you work around it.