I want to define an element that points to a same element type, something like this:
#define Foo { Foo*, ..., ... }
For example, this helps me to create a simple tree without creating any auxiliar class:
#define TreeNode std::deque(std::pair(char, TreeNode*))
TreeNode mRootNode;
However, this cannot be done, because a Foo
isn't still declared when making a reference to itself in its declaration.
My question is... why the same feature is allowed when implementing it with classes? Is there another simpler way, not Object Oriented, to define my Foo
?