Imagine I have two vectors:
std::vector<int> A,B;
//Push a bunch of data into A
//Push a bunch of data into B
For whatever reason, I want to create an interface to these vectors such as follows:
packed combined(A,B);
for(packed::iterator i=combined.begin();i!=combined.end();++i)
*i+=1;
This will have the same effect as:
for(std::vector::iterator i=A.begin();i!=A.end();++i)
*i+=1;
for(std::vector::iterator i=B.begin();i!=B.end();++i)
*i+=1;
I could code up a class to do this, but it seems like the code may already exist in a library somewhere. Does anyone know if this is the case?
Alternatively, can you think of a cunning way to do this?