This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

### 1035. `<array>::swap` can invalidate references, pointers, and iterators

Section: 24.2.2.1 [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 24.3.7.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]