Title
make_move_iterator() cannot be used to construct a move_iterator for a move-only iterator
Status
c++20
Section
[move.iter.nonmember]
Submitter
Patrick Palka

Created on 2020-02-07.00:00:00 last changed 37 months ago

Messages

Date: 2020-02-10.19:13:13

Proposed resolution:

This wording is relative to N4849.

  1. Modify [move.iter.nonmember] as indicated:

    template<class Iterator>
    constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
    

    -6- Returns: move_iterator<Iterator>(std::move(i)).

Date: 2020-02-10.19:13:13

[ 2020-02 Prioritized as IMMEDIATE Monday morning in Prague ]

Date: 2020-02-07.00:00:00

P1207R4 ("Movability of single-pass iterators") introduces the notion of a move-only non-forward iterator and makes some changes to the existing specification to realize that support.

The problem is that the specification of make_move_iterator() provided in [move.iter.nonmember] p6 does attempt to construct a move_iterator<Iterator> with an lvalue of i instead of an rvalue, having the effect of copying it instead of moving it, thus preventing to accept move-only iterators.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-10 19:13:13adminsetmessages: + msg11025
2020-02-10 19:13:13adminsetstatus: new -> immediate
2020-02-08 14:52:36adminsetmessages: + msg10998
2020-02-07 00:00:00admincreate