<array>::swap
can invalidate references, pointers, and iteratorsSection: 23.2.2 [container.requirements.general] Status: NAD Submitter: Alisdair Meredith Opened: 2009-03-12 Last modified: 2016-01-28
Priority: Not Prioritized
View other active issues in [container.requirements.general].
View all other issues in [container.requirements.general].
View all issues with NAD status.
Discussion:
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.
[ Summit: ]
Agree. The proposed resolution is incomplete. Further work required.
[ 2009-05-01 Daniel adds: ]
Issue 1099 also suggests adding move constructor to this.
[ 2009-07 post-Frankfurt: ]
Howard is to draft a note that explains what happens to references.
[ 2009-10 Santa Cruz: ]
Mark as NAD. No consensus for change.
[ 2009-08-01 Howard provided wording. ]
Proposed resolution:
Add a paragraph to 23.3.3.4 [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]