# 28 Algorithms library [algorithms]

## 28.6 Mutating sequence operations [alg.modifying.operations]

### 28.6.2 Move [alg.move]

```template<class InputIterator, class OutputIterator> OutputIterator move(InputIterator first, InputIterator last, OutputIterator result); ```

Requires: result shall not be in the range [first, last).

Effects: Moves elements in the range [first, last) into the range [result, result + (last - first)) starting from first and proceeding to last. For each non-negative integer n < (last-first), performs *(result + n) = std​::​move(*(first + n)).

Returns: result + (last - first).

Complexity: Exactly last - first move assignments.

```template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2> ForwardIterator2 move(ExecutionPolicy&& policy, ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result); ```

Requires: The ranges [first, last) and [result, result + (last - first)) shall not overlap.

Effects: Moves elements in the range [first, last) into the range [result, result + (last - first)). For each non-negative integer n < (last - first), performs *(result + n) = std​::​​move(*(first + n)).

Returns: result + (last - first).

Complexity: Exactly last - first assignments.

```template<class BidirectionalIterator1, class BidirectionalIterator2> BidirectionalIterator2 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result); ```

Requires: result shall not be in the range (first, last].

Effects: Moves elements in the range [first, last) into the range [result - (last-first), result) starting from last - 1 and proceeding to first.264 For each positive integer n <= (last - first), performs *(result - n) = std​::​move(*(last - n)).

Returns: result - (last - first).

Complexity: Exactly last - first assignments.

move_­backward should be used instead of move when last is in the range [result - (last - first), result).