Is there an elegant method of iterating through a multidimensional vector? Say, for instance, you have a 6D vector, though I think a 2D would suffice. Something like
vector< vector< int > myVector (6, vector<int> (5));
Is there a pretty way to iterate through this, starting from myVector[0][0], myVector[0][1], ...etc?
? I was trying it on larger dimensions, and using the Auto keyword to generate an iterator, but it's no good. Here's what I was trying:
for(auto it = myVector.begin(); it < myVector.end(); ++it)
std::cout << *it;
But it doesn't compile. Please forgive my rusty understanding of iterators in STL, it's been a long time...