I have this (simplified) situation:
class Tree { class Iterator { class Stack {
I don't want to clutter up class definitions, and I decide to write only method declarations within the classes themselves. Later (waaay below), when I want to define, say, a copy destination statement as follows:
Tree::Iterator::Stack& Tree::Iterator::Stack::operator = (const Stack& p_stack) {
I have to deal with these nasty permissions. I am wondering if there is a way to shorten them , because using and typedef , as I know them, do not offer me anything.
EDIT: since this is not CodeReview, but @Yulian requested clarification, here's a short version:
I am doing an iterative implementation of Red-Black Tree. The mentioned class Iterator designed to move in order (therefore, it depends on the order), and class Stack is its utility class. In this short program, only class Tree uses Iterator , and only Iterator uses Stack .
After reminding @Yulian, I remembered that it would be more object-oriented if the mentioned classes were separately defined (perhaps even as templates), but this is a small stand-alone program, and I'm trying to save it this way.
EDIT: stand-alone also means that it is an isolated, single-file program, so no .h files or external code to reuse. What for? Because ACADEMIA (and related arbitrary restrictions).