So I'm running through a list and erasing values that aren't divisible by 5 and 11. Right after I initialize an iterator to the beginning of a list, I assert if the iterator matches the beginning of the list, but it immediately fails. Why doesn't this work?
for(std::list<int>::iterator itr = numlist.begin(); itr != numlist.end(); itr++) {
assert(itr == numlist.begin());
if(*itr % 5 == 0 || *itr % 11 == 0) {
itr = numlist.erase(itr);
}
}