-
Vector within a vector
Is it possible to have vectors made up of vectors?
If so, how would I accomplish this? If not, is there an alternative that would provide the same result?
I'm confused of how to do a vector within a vector....because I originally thought of:
Code:
vector<vector<string>> vstrInventory;
For example, but that didn't seem right to me for some reason :/
-
You have to use some spaces.
Code:
vector< vector<string> > vstrInventory;
I'm not sure why.
-
The token >> makes the compiler confused when you use it with nested templates, so you must use a space between the any two > signs:
std::vector<std::vector<std::string> > vec2D;
-