I've seen code examples for assigning 2 dimensional vectors, but I haven't seen code for assigning more than that. I tried to create a 3 dimensional vector, and the only code the IDE didn't complain about was
1 2 3 4 5
int x = 2;
int y = 2;
int z = 2;
vector < vector < vector <string> > >stringvec;
stringvec.assign(x, vector <string>(y), vector <string>(z));
Would this be the correct way of producting a vector[2][2][2]?
> but it seems to me that all you're doing is re-sizing that particular dimension over and over again.
We need to resize each element (which is a vector) individually.
1 2 3 4
std::vector<int> array[3] ; // array of three empty vectors
array[0].resize(5) ; // row 0 resized to five, rows 1 and 2 are still empty
array[1].resize(5) ; // row 1 resized to five, row 2 is still empty
array[2].resize(5) ; // row 2 resized to five