This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
Section: 22.214.171.124 [forwardlist.modifiers] Status: C++11 Submitter: James McNellis Opened: 2010-07-16 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [forwardlist.modifiers].
View all issues with C++11 status.
In N3092 126.96.36.199 [forwardlist.modifiers], the resize() member function is declared as:
void resize(size_type sz, value_type c);
The other sequence containers (list, deque, and vector) take 'c' by const reference.
Is there a reason for this difference? If not, then resize() should be declared as:
void resize(size_type sz, const value_type& c);
The declaration would need to be changed both at its declaration in the class definition at 21.3.9 [forwardlist]/3 and where its behavior is specified at 188.8.131.52 [forwardlist.modifiers]/22.
This would make forward_list consistent with the CD1 issue 679.
[ Post-Rapperswil ]
Daniel changed the P/R slightly, because one paragraph number has been changed since the issue had been submitted. He also added a similar Requires element that exists in all other containers with a resize member function. He deliberately did not touch the wrong usage of "default-constructed" because that will be taken care of by LWG issue 868.
Moved to Tentatively Ready with revised wording after 5 positive votes on c++std-lib.
[ Adopted at 2010-11 Batavia ]
... void resize(size_type sz); void resize(size_type sz, value_type c); void clear(); ...
void resize(size_type sz); void resize(size_type sz, value_type c);
27 Effects: If sz < distance(begin(), end()), erases the last distance(begin(), end()) - sz elements from the list. Otherwise, inserts sz - distance(begin(), end()) elements at the end of the list. For the first signature the inserted elements are default constructed, and for the second signature they are copies of c.