Re: GLIBCXX_DEBUG bug in list::merge?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 18, 2008 at 12:21 AM, David Greene <greened@xxxxxxxxxxxxx> wrote:
>
>  Perhaps this was changed in the final standard.  I don't have access to
>  that document.  It surprises me that splice and merge would invalidate
>  iterators since a prime motivator for using std::list is iterator
>  stability and these two operations don't destroy any sequence values,
>  they just move them around.
>
>  No books on the standard library that I've found address iterator
>  stability for std::list splice and merge operations, which leads
>  the reader to assume that iterators remain valid.
>

void splice(iterator position, list<T,Allocator>& x)
23.2.2.4/4 Effects: Inserts the contents of x before position and x
becomes empty. Invalidates all iterators and references to the list x.

I think the rationale is that the end iterator associated with the
iterators change, so they are invalidated, even if the representation
of a typical iterator would not actually change.

HTH,
~ Scott

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux