rotate

C++ Reference

rotate
Syntax:
  #include <algorithm>
  inline iterator rotate( iterator start, iterator middle, iterator end );

The rotate() algorithm moves the elements in the range [start,end) such that the middle element is now where start used to be, (middle+1) is now at (start+1), etc.

The return value of rotate() is an iterator to start + (end-middle).

rotate() runs in linear time.

Related topics: