Next : , Previous : Reverse, Top : Table of  Contents


Rotate

rotate (ForwardIterator first, ForwardIterator middle, ForwardIterator last) Function
template 
void rotate(ForwardIterator first,
            ForwardIterator middle,
            ForwardIterator last);

For each non-negative integer i < (last - first), rotate places the element from the position first + i into position first + (i + (last - middle)) % (last - first). [first, middle) and [middle, last) are valid ranges. At most last - first swaps are done.

OutputIterator rotate_copy (ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result) Function

template 
OutputIterator rotate_copy(ForwardIterator first, ForwardIterator middle,                            ForwardIterator last, OutputIterator result);

rotate_copy copies the range [first, last) to the range [result, result + (last - first)) such that for each non-negative integer i < (last - first) the following assignment takes place: *(result + (i + (last - middle)) % (last - first)) = *(first + i). rotate_copy returns result + (last - first). Exactly last - first assignments are done. The result of rotate_copy is undefined if [first, last) and [result, result + (last - first)) overlap.


 

Top