I have following requirement,
std::vector< std::vector < std::string > > segments;
There are unknown number of segments, but each segment is of fixed size say 1000. But, I am not able to figure out how do I declare variable segments with my requirements.
I tried
std::vector< std::vector < std::string >(1000) > segments; // not working
Thanks in advance..
You can’t. You have to loop through and call
reservemanually. (And for that matter there are novectors insidesegmentsyet.. how could reserve space in a nonexistent vector? 🙂 )