979. Bad example

Section: 24.5.4 [move.iterators] Status: NAD Editorial Submitter: Howard Hinnant Opened: 2009-02-03 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [move.iterators].

View all issues with NAD Editorial status.

Discussion:

24.5.4 [move.iterators] has an incorrect example:

-2- [Example:

set<string> s; 
// populate the set s 
vector<string> v1(s.begin(), s.end());          // copies strings into v1 
vector<string> v2(make_move_iterator(s.begin()), 
                  make_move_iterator(s.end())); // moves strings into v2

-- end example]

One can not move from a set because the iterators return const references.

[ Batavia (2009-05): ]

We agree with the proposed resolution. Move to NAD Editorial.

Proposed resolution:

Change 24.5.4 [move.iterators]/2:

-2- [Example:

setlist<string> s; 
// populate the setlist s 
vector<string> v1(s.begin(), s.end());          // copies strings into v1 
vector<string> v2(make_move_iterator(s.begin()), 
                  make_move_iterator(s.end())); // moves strings into v2

-- end example]