Iterator for multi-dimensional vector that is used as unidimensional?
问题 I have a vector that looks like this: std::vector<std::vector<MyClass>> myVector; And I would like to access its elements through iterators as if it was an unidimensional vector: for (auto& x : myVector) { foo(x); // x is an object of type MyClass } (i.e. the fact that there are multiple dimensions is transparent to whoever loops through myVector) I have an idea of how this should be done, have a custom iterator implementation that saves current indexes so that when one of the vectors has no