erase returns an iterator to the first element after the erase(d) one(s).
So it could be done like that
kurtCode:for (list<Foo>::iterator it = myList.begin( ); i != myList.end( ) ) { if (it->NeedsDeletion( )) { it = myList.erase(it); } else
| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | VB Forums | Developer.com |
|
Results 1 to 15 of 20
Thread: Setting an iterator to "end"Threaded View
|
Click Here to Expand Forum to Full Width |