------- Comment #1 from redi at gcc dot gnu dot org 2009-10-08 09:42 ------- set::insert never invalidates iterators, so that's not a good example. set::erase invalidates iterators pointing to erased elements, but debug mode already catches that.
One problem I see with this request is that when debug mode detects a problem it aborts the program. If I understand your request correctly, it would mean that programs could abort when they haven't done anything wrong, e.g. std::set<int> s; std::set<int>::iterator i = s.insert(5); s.erase(2); return *i; The erase call would have updated the mutation count so it no longer matches the iterator's mutation count, but the program is correct so why should it abort? If I've misunderstood, could you give an example of problems you want to solve? -- redi at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jwakely dot gcc at gmail dot | |com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41628