For practice, I am trying to make a recursive directory parser.
To express the syntax, I want to also produce the resulting result, for example:
1 class CDirectory 2 { 3 private: 4 std::string name; 5 std::vector<CDirectory> subDirectories 6 public: 7
However, here I see that line 5 is not supported by the behavior - "The C ++ (2003) standard clearly states that instantiating a standard container with an incomplete type causes undefined-behavior."
What should I do? Is there no way to make an object containing a list of similar objects? If nothing else, I know that it is by no means illegal to create a vector of vectors, so an object that contains itself.
source share