I have a list interator
Code:
list<ClassA*>::iterator it;
for(it = list1.begin(); it != list1.end(); ++it)
{
if( (*it)->itsvalB == myvalB)
{
break;
}
}
if(it == list1.begin())
{ do A; }
if(it == list1.end())
{ do B; }
else
{ list<ClassA*>::iterator it1 = ++it;
cout<<(*it1)->itsvalB<<endl;
}
this will not increment to the next val in list1. how can i do such a thing?
I don't want to increment it1 in the for loop, because then it1 will increment past the end of the loop for the last increment (i think).
Many thanks for the help again.