B
BCC
I have the following code, where good_list is a vector of CUnits:
int high_cutoff = 10;
vector<CUnit>::iterator it;
for (it = good_list.end(); it != good_list.begin(); --it) {
CUnit* ccu = it;
if (ccu->GetCutoff() >= high_cutoff) {
good_list.erase(it);
}
}
Doesn't give any errors, but also does not seem to be removing the element
correctly from good_list.
There something wrong with the above code?
Thanks
int high_cutoff = 10;
vector<CUnit>::iterator it;
for (it = good_list.end(); it != good_list.begin(); --it) {
CUnit* ccu = it;
if (ccu->GetCutoff() >= high_cutoff) {
good_list.erase(it);
}
}
Doesn't give any errors, but also does not seem to be removing the element
correctly from good_list.
There something wrong with the above code?
Thanks