Rotating Elements While Copying
OutputIterator rotate_copy (ForwardIterator sourceBeg, ForwardIterator newBeg, ForwardIterator sourceEnd, OutputIterator destBeg) • Is a combination of copy() and rotate(). • Copies the elements of the source range [sourceBeg,sourceEnd) into the destination range start- ing with destBeg in rotated order so that *newBeg is the new first element. • Returns destBeg+(sourceEnd-sourceBeg), which is the position after the last copied element in the destination range. • The caller must ensure that newBeg is an element in the range [beg,end); otherwise, the call results in undefined behavior