std::move_backward
From cppreference.com
Defined in header <algorithm>
|
||
template< class BidirectionalIterator1, class BidirectionalIterator2 > BidirectionalIterator2 move_backward( BidirectionalIterator1 first, |
||
Moves the elements from the range [first, last), to another range ending at d_last. The elements are moved in reverse order (the last element is moved first), but their relative order is preserved.
Contents |
[edit] Parameters
first, last | - | the range of the elements to move |
d_last | - | end of the destination range. If d_last is within [first, last), std::move must be used instead of std::move_backward. |
[edit] Return value
Iterator in the destination range, pointing at the last element moved.
[edit] Complexity
Exactly last - first move assignments.
[edit] Possible implementation
template< class BidirectionalIterator1, class BidirectionalIterator2 > BidirectionalIterator2 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 d_last) { while (first != last) { *(--d_last) = std::move(*(--last)); } return d_last; } |
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
(C++11) |
moves a range of elements to a new location (function template) |