I have declared a vector with 3 Dimensions with the first code below.
Then I have managed to push_back all the 3 dimensions so my vector is filled up like this:
vector1[2][2][2]
typedef std::vector<string> String1D;
typedef std::vector<String1D> String2D;
typedef std::vector<String2D> String3D;
String3D vector1;
What I now need to do is to iterate from vector1[0][0][0] until vector1[2][2][2]
with the code below.
But I get a huge of compileerrors. I think The code below can work if you havn´t declared the vector with typedef but I am not sure really.
I wonder if I am near a solution for this ? It is difficult to find examples for 3D vectors.
std::vector< std::vector<string> >::iterator OneDStart = vector1.begin();
std::vector< std::vector<string> >::iterator OneDEnd = vector1.end();
for ( ; OneDStart != OneDEnd; OneDStart++ )
{ //1D
std::vector<string>::iterator TwoDStart = OneDStart->begin();
std::vector<string>::iterator TwoDEnd = OneDStart->end();
for ( ; TwoDStart != TwoDEnd; TwoDStart++ )
{ //2D
std::vector<string>::iterator ThreeDStart = TwoDStart->begin();
std::vector<string>::iterator ThreeDEnd = TwoDEnd->end();
for ( ; ThreeDStart != ThreeDEnd; ThreeDStart++ )
{ //3D
} //1D
} //2D
} //3D