R
raven.mp4
Hi,
I have a little question about std::list iterators. Take a look at
this piece of code:
list<Type*>::iterator it = myList.begin();
Type *p;
for(it; it != myList.end(); ++it)
{
p = (*it);
if(...)
{
myList.pop_front();
InsertIntoList(p); // inserts p into new location
it = myList.begin();
}
else
break;
}
Why 'it = myList.begin()' doesn't set 'it' to the beginning of the
myList?
I have a little question about std::list iterators. Take a look at
this piece of code:
list<Type*>::iterator it = myList.begin();
Type *p;
for(it; it != myList.end(); ++it)
{
p = (*it);
if(...)
{
myList.pop_front();
InsertIntoList(p); // inserts p into new location
it = myList.begin();
}
else
break;
}
Why 'it = myList.begin()' doesn't set 'it' to the beginning of the
myList?