I have code that looks essentially like this:
std::map<int, int> map1, map2;
BOOST_FOREACH(int i, map1)
{
// do steps 1-5 here...
}
BOOST_FOREACH(int i, map2)
{
// do steps 1-5 (identical to above) here...
}
Is there any way to concatenate the maps to eliminate the duplicate code in the second loop? Or a way to extend BOOST_FOREACH to iterate over two different maps in one go? Obviously I don't want to increase the time complexity of the program (otherwise I could just create a new map and insert into it map1 and map2). I have a feeling I am missing something rudimentary here.