A
Allerdyce.John
In STL list, is it safe to do this:
list<A> aList; //private attribute of MyClass
void MyClass:: aMethod() {
list<A>::Iterator iter;
for ( iter = aList.begin() ; iter != aList.end() ; iter++) {
A a = (*iter);
if ( check(a) ) {
aList.erase (iter); // is that okay?
}
}
}
Thank you.
list<A> aList; //private attribute of MyClass
void MyClass:: aMethod() {
list<A>::Iterator iter;
for ( iter = aList.begin() ; iter != aList.end() ; iter++) {
A a = (*iter);
if ( check(a) ) {
aList.erase (iter); // is that okay?
}
}
}
Thank you.