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.

3759. ranges::rotate_copy should use std::move

Section: 27.7.11 [alg.rotate] Status: WP Submitter: Hewill Kang Opened: 2022-08-25 Last modified: 2022-11-17

Priority: Not Prioritized

View all other issues in [alg.rotate].

View all issues with WP status.

Discussion:

The range version of ranges::rotate_copy directly passes the result to the iterator-pair version. Since the type of result only models weakly_incrementable and may not be copied, we should use std::move here.

[2022-09-23; Reflector poll]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4910.

  1. Modify 27.7.11 [alg.rotate] as indicated:

    template<forward_range R, weakly_incrementable O>
      requires indirectly_copyable<iterator_t<R>, O>
      constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
        ranges::rotate_copy(R&& r, iterator_t<R> middle, O result);
    

    -11- Effects: Equivalent to:

    return ranges::rotate_copy(ranges::begin(r), middle, ranges::end(r), std::move(result));