std::move_backward
From cppreference.com
Defined in header <algorithm>
|
||
template< class BidirIt1, class BidirIt2 >
BidirIt2 move_backward( BidirIt1 first, BidirIt1 last, BidirIt2 d_last ); |
||
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.
|
Type requirements | ||
-
BidirIt1, BidirIt2 must meet the requirements of BidirectionalIterator .
|
[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 BidirIt1, class BidirIt2 > BidirIt2 move_backward(BidirIt1 first, BidirIt1 last, BidirIt2 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) |