ranges::rotate_copy
should use std::move
Section: 26.7.11 [alg.rotate] Status: C++23 Submitter: Hewill Kang Opened: 2022-08-25 Last modified: 2023-11-22
Priority: Not Prioritized
View all other issues in [alg.rotate].
View all issues with C++23 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.
Modify 26.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));