I just had a bug whose issue was using stale unstable iterators after
changing the container.  It would be nice for _GLIBCXX_DEBUG to catch
those.  e.g., container object holds a "mutation count" and
increments it on every call that is allowed to destabilize extant
iterators in the API (even if it doesn't, like a set insert with no
change if the spec says that can invalidate), iterator holds ptr to
container object and the mutation count sampled at iterator creation
time, all iterator ops throw if the mutation count no longer matches
the container.


-- 
           Summary: _GLIBCXX_DEBUG feature: check for unstable iterators
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roland at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41628

Reply via email to