Sorry the construct is like this

std::vector<int>::iterator  iter1;
std::vector<std::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;

    .....
}

I have change the || into &&.

Thanks,
Gokul

On Sun, Feb 21, 2010 at 8:20 PM, Gokulakannan Somasundaram <gokul007@gmail.com> wrote:
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::vector<std::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.