
21 Oct
2008
21 Oct
'08
1:39 p.m.
Hartmut Kaiser escribió:
assert(start != end);
// remove entry in map which corresponds to this type do{ if(this == *start) x.erase(start++); else ++start; }while(start != end);
After looking at this code again I have the impression that it is broken anyways. You can't safely increment an iterator after deleting the object it points to: erase(start++).
I think your objection is wrong: erase(start++) is perfectly safe because the incrementing op is executed before erase is invoked. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo