This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

3390. make_move_iterator() cannot be used to construct a move_iterator for a move-only iterator

Section: [move.iter.nonmember] Status: C++20 Submitter: Patrick Palka Opened: 2020-02-07 Last modified: 2021-02-25

Priority: 0

View all other issues in [move.iter.nonmember].

View all issues with C++20 status.


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.

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

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)).