std::list<>::splice invalidation of iterators

B

Ben Pfaff

The C++ standard says in 23.2.2.4 "list operations" that the
various forms of splice invalidate iterators and references to
the spliced elements. This makes the splice operation a lot less
useful than it otherwise could be. It seems unnecessary to
invalidate these iterators and references, and I am puzzled why
the standard says that it happens. Furthermore, the "merge"
operation that also moves elements from one list to another does
not have any note saying that it invalidates any iterators or
references.

Can anyone enlighten me?
 
J

jkherciueh

Ben said:
The C++ standard says in 23.2.2.4 "list operations" that the
various forms of splice invalidate iterators and references to
the spliced elements. This makes the splice operation a lot less
useful than it otherwise could be. It seems unnecessary to
invalidate these iterators and references, and I am puzzled why
the standard says that it happens.

No reason. The working paper n2461 indicates that the next standard will
change those provisions.
Furthermore, the "merge"
operation that also moves elements from one list to another does
not have any note saying that it invalidates any iterators or
references.

Can anyone enlighten me?


Best

Kai-Uwe Bux
 
B

Ben Pfaff

No reason. The working paper n2461 indicates that the next standard will
change those provisions.

Thanks so much for pointing that out. The provisions of n2461
look great.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top