Condividi tramite


move_backward

Moves the elements of one iterator to another. The move starts with the last element in a specified range, and ends with the first element in that range.

template<class BidirectionalIterator1, class BidirectionalIterator2>
    BidirectionalIterator2 move_backward(
        BidirectionalIterator1 _First, 
        BidirectionalIterator1 _Last,
        BidirectionalIterator2 _Dest
    );

Parameters

  • _First
    An iterator that indicates the start of a range to move elements from.

  • _Last
    An iterator that indicates the end of a range to move elements from. This element is not moved.

  • _Dest
    An output iterator that indicates the start of a range to copy elements to.

Property Value/Return Value

Returns an iterator that refers to the first element that is not moved.

Remarks

The template function evaluates *(_Dest - N - 1) = move(*(_Last - N - 1))) once for each N in the range [0, _Last - _First), for strictly increasing values of N starting with the lowest value. It then returns _Dest - (_Last - _First). If _Dest and _First designate regions of storage, _Dest must not be in the range [_First, _Last).

move and move_backward are functionally equivalent to using copy with a move iterator.

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

<algorithm>

Standard Template Library

Other Resources

<algorithm> Members