reverse_copy
Copies the elements while reversing their order
Definition
The reverse_copy() algorithm is defined in the standard header <algorithm> and in the nonstandard backward-compatibility header <algo.h>.
Interface
#include <algorithm>
template < class BidirectionalIterator, class OutputIterator >
OutputIterator reverse_copy(
BidirectionalIterator first,
BidirectionalIterator last,
OutputIterator result
);Parameters:
| Parameter | Description |
| first | A bidirectional iterator pointing to the position of the first element in the source range within which the elements are being permuted |
| last | A bidirectional iterator pointing to the position one past the final element in the source range within which the elements are being permuted |
| result | An output iterator pointing to the position of the first element in the destination range to which elements are being copied |
Description
Reverse_copy copies the elements from the range [first, last), to another range beginning at result in such a way, that the elements in the new range are in reverse order.
Return Value
Returns an iterator on the element following the last element copied.
Complexity
The complexity is linear; performs last - first assignments.
References
Blank
CodeCogs®