bug in library standard 23.2.1.3/4

AlisdairM alisdair.meredith@uk.renaultf1.com
Thu Feb 15 22:25:00 GMT 2007


Steve LoBasso wrote:

> The problem is the standard doesn't say that end() will become
> invalid. This is probably why the debug implementation doesn't catch
> the problem [ie. compiling with -D_GLIBCXX_DEBUG].

<delurk>

If I understand correctly, the standard says very little about end
iterators, wrt invalidation.  THe weasel-wording is that most of the
wording describing when an iterator is invalidated talk about iterators
in the sequence, or similar, but end iterators are
one-past-the-end-of-the-sequence, but not actually in the sequence, and
so are not covered.

An implementation is usually free to invalidate an end iterator as it
feels, including never if it so chooses.

<relurk>

-- 
AlisdairM



More information about the Libstdc++ mailing list