std::rotate_copy() algorithm
- od C++20
- od C++17
- do C++17
// (1)
template< class ForwardIt, class OutputIt >
constexpr OutputIt rotate_copy( ForwardIt first, ForwardIt n_first,
ForwardIt last, OutputIt d_first );
// (2)
template< class ExecutionPolicy, class ForwardIt1, class ForwardIt2 >
ForwardIt2 rotate_copy( ExecutionPolicy&& policy,
ForwardIt1 first, ForwardIt1 n_first,
ForwardIt1 last, ForwardIt2 d_first );
// (1)
template< class ForwardIt, class OutputIt >
OutputIt rotate_copy( ForwardIt first, ForwardIt n_first,
ForwardIt last, OutputIt d_first );
// (2)
template< class ExecutionPolicy, class ForwardIt1, class ForwardIt2 >
ForwardIt2 rotate_copy( ExecutionPolicy&& policy,
ForwardIt1 first, ForwardIt1 n_first,
ForwardIt1 last, ForwardIt2 d_first );
// (1)
template< class ForwardIt, class OutputIt >
OutputIt rotate_copy( ForwardIt first, ForwardIt n_first,
ForwardIt last, OutputIt d_first );
-
(1) Copies the elements from the range [
first
;last
), to another range beginning atd_first
in such a way, that the element*(n_first)
becomes the first element of the new range and*(n_first - 1)
becomes the last element. -
(2) Same as (1), but executed according to
policy
.Overload ResolutionThese overloads participate in overload resolution only if
std::is_execution_policy_v<std::decay_t<ExecutionPolicy>>
(do C++20)std::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>>
(od C++20) istrue
.
Undefined Behaviour
The behavior is undefined
if either [first
; n_first
) or [n_first
; last
) is not a valid range, or the source and destination ranges overlap.Parameters
first last | The range of elements to copy. |
n_first | An iterator to an element in [ |
d_first | The beginning of the destination range. |
policy | The execution policy to use. See execution policy for details. |
Type requirements
ForwardIt1 ForwardIt2 ForwardIt3 | LegacyForwardIterator |
OutputIt | LegacyOutputIterator |