mardi 24 mars 2015

The quickest method to delete items inside for - range loop

I thinking about this loop:



struct tmp {
int min;
int max;
tmp(int a, int b) :min(a), max(b){};
};

std::vector <tmp> data;

for (auto tmp_a : data){
if(tmp_a.min == 0){
//how to delete tmp_a item from data from there?
}
}


Of course I can iterate this loop, but I dont think that is the fastest way. (of course I can be wrong - correct me then)


Question: How to delete item inside range loop ? (using the fastest method)


Aucun commentaire:

Enregistrer un commentaire