Assume we have the following:
struct MyClass {
typedef vector<MyValue> InnerVector;
const InnerVector & get() { ... }
};
vector<MyClass> classes;
Is there a way to provide a "flattened" iterator over classes
? That is to view classes
as if its some list of InnerVector
. Each dereference of the iterator is expected to return an InnerVector
. Something like the following:
auto all_inner_vectors = magic_iterator(classes);
for (auto inner_vector : all_inner_vectors) {
...
}
It seems that boost iterator adaptors could be handy here. But I could not figure out what adaptors would fit this purpose.