共用方式為


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 _DestEnd
    );

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.

  • _DestEnd
    A bidirectional iterator addressing the position of one past the final element in the destination range.

Property Value/Return Value

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

Remarks

The template function evaluates *(_DestEnd - 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 _DestEnd - (_Last - _First). If _DestEnd and _First designate regions of storage, _DestEnd must not be in the range [_First, _Last).

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

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

<algorithm>

copy_backward

Standard Template Library