
21 Feb
2010
21 Feb
'10
2:50 p.m.
Hi, Is it possible to use Boost Foreach to iterate over two containers simultaneously? I have done my preliminary search in the lists and i couldn't find a solution. I am asking for a solution to iteration like this std::vector<int>::iterator iter1; std::vectorstd::string::iterator iter2; for( iter1 = cont1->begin(), iter2 = cont2->begin(); iter1 != cont1->end() || iter2 != cont2->end(); ++iter1, ++iter2 ) { int x = *iter1; std::string y = *iter2; ..... } If this is not present, please consider this as a feature request. The syntax below can also be considered forboth( int x, std::string y, cont1, cont2 ) { } Thanks, Gokul.