Created on 2016-04-25.00:00:00 last changed 89 months ago
Proposed resolution:
This wording is relative to N4582.
In [sequence.reqmts], edit Table 107 (Sequence container requirements) as indicated:
Table 107 — Sequence container requirements (in addition to container) Expression Return type Assertion/note
pre-/post-condition[…] a.assign(i, j) void Requires: T shall be EmplaceConstructible into X from *i and assignable from *i.
For vector, if the iterator does not meet the forward iterator requirements (24.2.5),
T shall also be MoveInsertable into X.
Each iterator in the range [i, j) shall be dereferenced exactly once.
pre: i, j are not iterators into a.
Replaces elements in a with a copy of [i, j).
Invalidates all references, pointers and iterators referring to the elements of a.
For vector and deque, also invalidates the past-the-end iterator.[…] a.assign(n, t) void Requires: T shall be CopyInsertable into X and CopyAssignable.
pre: t is not a reference into a.
Replaces elements in a with n copies of t.
Invalidates all references, pointers and iterators referring to the elements of a.
For vector and deque, also invalidates the past-the-end iterator.
[ 2016-05 Issues Telecon ]
This is related to 2256
The sequence container requirements table says nothing about the effect of assign() on iterators, pointers or references into the container. Before LWG 2209 (and LWG 320 for std::list), assign() was specified as "erase everything then insert", which implies wholesale invalidation from the "erase everything" part. With that gone, the blanket "no invalidation" wording in [container.requirements.general]/12 would seem to apply, which makes absolutely no sense.
The proposed wording below simply spells out the invalidation rule implied by the previous "erase everything" wording.History | |||
---|---|---|---|
Date | User | Action | Args |
2017-07-30 20:15:43 | admin | set | status: wp -> c++17 |
2016-06-28 12:50:44 | admin | set | status: ready -> wp |
2016-05-22 15:38:38 | admin | set | messages: + msg8141 |
2016-05-22 15:38:38 | admin | set | status: new -> ready |
2016-05-08 11:39:51 | admin | set | messages: + msg8094 |
2016-04-25 00:00:00 | admin | create |