Good morning,
I am trying for a loop when a particular condition is met in an unordered_multiset
with the end
operation. But it does not work and I get a Segmentation fault in the next iteration of the loop.
Code:
std::unordered_multiset<Element, ElementHash>::iterator itr;
Element elementTemp1("");
for (itr = almacen.begin(); itr != almacen.end(); ++itr) {
Element tmp(*itr);
if(tmp.getNombre() == "prueba"){
itr = almacen.end();
}
}
How can I solve it? Or maybe my structure is not the right one.
Aucun commentaire:
Enregistrer un commentaire