I think this should do the trick in an efficient way...
its even using the faster ++it....
int high_cutoff = 10;
vector<CUnit>::reverse_iterator it;
for (it = good_list.rbegin(); it != good_list.rend(); ) {
if (it->GetCutoff() >= high_cutoff) {
it = good_list.erase(it.base()-1);
}
else {
++it;
}
}
any thoughts?
|