Jun 6, 2006 #1 Lorey Programmer Feb 16, 2003 88 SG HI! Anybody knows how to initialize a vector of structure? Like std::vector<std::vector<structtype>> where struct structtype {std::String s; unsigned long n}
HI! Anybody knows how to initialize a vector of structure? Like std::vector<std::vector<structtype>> where struct structtype {std::String s; unsigned long n}
Jun 6, 2006 #2 cpjust Programmer Sep 23, 2003 2,132 US What do you want to initialize it to? If you want to populate the vector when it's defined -- you can't do that. Upvote 0 Downvote
What do you want to initialize it to? If you want to populate the vector when it's defined -- you can't do that.
Jun 6, 2006 #3 NullTerminator Programmer Oct 13, 1998 293 US This looks like a two dimensional vector of structures // make sure to put a space between the two > >'s std::vector<std::vector<structtype> > vvs; std::vector<structtype> vs vs.push_back( structype("some string", 15) ); vvs.push_back(vs); Upvote 0 Downvote
This looks like a two dimensional vector of structures // make sure to put a space between the two > >'s std::vector<std::vector<structtype> > vvs; std::vector<structtype> vs vs.push_back( structype("some string", 15) ); vvs.push_back(vs);