resize(size()) on a listSection: 23.3.11.3 [list.capacity] Status: C++11 Submitter: BSI Opened: 2010-08-25 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [list.capacity].
View all issues with C++11 status.
Discussion:
Addresses GB-115
There is no mention of what happens if sz==size(). While
it obviously does nothing I feel a standard needs to say
this explicitely.
[ Resolution proposed in ballot comment ]
Express the semantics as pseudo-code similarly
to the way it is done for the copying overload that
follows (in p3). Include an else clause that does
nothing and covers the sz==size() case.
[ 2010 Batavia ]
Accepted with a simplified resolution turning one of the <
comparisons into <=.
Proposed resolution:
Ammend [list.capacity] p1:
void resize(size_type sz);Effects: If
sz <= size(), equivalent tolist<T>::iterator it = begin(); advance(it, sz); erase(it, end());. Ifsize() < sz, appendssz - size()default constructedvalue initialized elements to the sequence.