Next : Random shuffle, Previous : Reverse, Top : Table of Contents
rotate (ForwardIterator first, ForwardIterator middle, ForwardIterator last) | Function |
templateFor 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.void rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
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.
|
|