cpp/algorithm/ranges/shift

Shifts the elements in the range or  by  positions. The behavior is undefined if is not a valid range.

@1@ Shifts the elements towards the beginning of the range:
 * If, there are no effects.
 * If, the behavior is undefined.
 * Otherwise, for every integer in, moves the element originally at position  to position . The moves are performed in increasing order of  starting from.

@3@ Shifts the elements towards the end of the range:
 * If, there are no effects.
 * If, the behavior is undefined.
 * Otherwise, for every integer in, moves the element originally at position  to position . If  models , then the moves are performed in decreasing order of  starting from.

@2, 4@ Same as or  respectively, but uses  as the range, as if using  as  and  as.

Elements that are in the original range but not the new range are left in a valid but unspecified state.

Return value
@1-2@, where is the end of the resulting range and equivalent to: @3-4@, where is the beginning of the resulting range and equivalent to:
 * , if is less than ;
 * otherwise.
 * , if is less than ;
 * otherwise.

Complexity
@1-2@ At most assignments. @3-4@ At most assignment or swaps.