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

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

Section: 23.5.3.8 [move.iter.nonmember] Status: WP Submitter: Patrick Palka Opened: 2020-02-07 Last modified: 2020-02-24

Priority: 0

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

View all issues with WP status.

Discussion:

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