Title
<array>::swap can invalidate references, pointers, and iterators
Status
nad
Section
[container.requirements.general]
Submitter
Alisdair Meredith

Created on 2009-03-12.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Add a paragraph to [array.special]:

template <Swappable T, size_t N> void swap(array<T,N>& x, array<T,N>& y);

Effects:

swap_ranges(x.begin(), x.end(), y.begin());

[Note: Outstanding iterators, references and pointers may be invalidated. — end note]

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Mark as NAD. No consensus for change.

Date: 2010-10-21.18:28:33

[ 2009-07 post-Frankfurt: ]

Howard is to draft a note that explains what happens to references.

Date: 2009-05-01.00:00:00

[ 2009-05-01 Daniel adds: ]

Issue 1099 also suggests adding move constructor to this.

Date: 2010-10-21.18:28:33

[ Summit: ]

Agree. The proposed resolution is incomplete. Further work required.

Date: 2012-10-21.13:19:07

Addresses UK 226 [CD1]

<array> must be added to this list. In particular it doesn't satisfy: - no swap() function invalidates any references, pointers, or iterators referring to the elements of the containers being swapped. and probably doesn't satisfy: - no swap() function throws an exception.

If <array> remains a container, this will have to also reference array, which will then have to say which of these points it satisfies.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg420
2010-10-21 18:28:33adminsetmessages: + msg419
2010-10-21 18:28:33adminsetmessages: + msg418
2010-10-21 18:28:33adminsetmessages: + msg417
2010-10-21 18:28:33adminsetmessages: + msg416
2009-03-12 00:00:00admincreate