This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.
vector::resize(n, t)'s specification should be simplifiedSection: 23.3.13.3 [vector.capacity], 23.3.5.3 [deque.capacity] Status: C++14 Submitter: Stephan T. Lavavej Opened: 2013-09-21 Last modified: 2017-07-05
Priority: 0
View other active issues in [vector.capacity].
View all other issues in [vector.capacity].
View all issues with C++14 status.
Discussion:
First, 23.3.5.3 [deque.capacity]/4 and 23.3.13.3 [vector.capacity]/16 say that resize(size_type sz, const T& c)
"Requires: T shall be MoveInsertable into *this and CopyInsertable into *this."
The CopyInsertable requirement is correct (because sz might be size() + 2 or more), but the
MoveInsertable requirement is redundant due to 23.2.2 [container.requirements.general]/13: "T is
CopyInsertable into X means that, in addition to T being MoveInsertable into X, the [...]".
(LWG 2033(i)'s resolution said that this was "not redundant, because CopyInsertable is not necessarily a refinement
of MoveInsertable" which was true at the time, but then LWG 2177(i)'s resolution made it a refinement.)
CopyInsertable T there are no effects." This is confusing because T is required to be
CopyInsertable. (/14 says the same thing for resize(size_type sz), where it is correct because that overload
requires only MoveInsertable and DefaultInsertable.)
[Issaquah 2014-02-11: Move to Immediate]
Proposed resolution:
This wording is relative to N3691.
Edit 23.3.5.3 [deque.capacity]/4 as indicated:
void resize(size_type sz, const T& c);[…]
-4- Requires:Tshall beMoveInsertableinto*thisandCopyInsertableinto*this.
Edit 23.3.13.3 [vector.capacity]/16+17 as indicated:
void resize(size_type sz, const T& c);[…]
-16- Requires:Tshall beMoveInsertableinto*thisandCopyInsertableinto*this. -17- Remarks: If an exception is thrownother than by the move constructor of a non-there are no effects.CopyInsertableT