c++ - Object containing lists of itself recursively -


for practice, trying make recursive directory parser.

for sake of parsimony, want contain result recursively too, e.g.:

1 class cdirectory 2 { 3     private: 4        std::string name; 5        std::vector<cdirectory> subdirectories 6    public: 7        //various things, constructors etc. go here 8 } 

however, i see here line 5 not supported behavior - "the c++ standard (2003) says instantiating standard container incomplete type, invokes undefined-behavior."

what, then, do? there no way make object contain list of similar objects? if nothing else, know no means illegal make vector of vectors, that's object contains itself.

make vector of pointers

std::vector<cdirectory*> subdirectories; 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -