template<class BidirectionalIterator>
void reverse(BidirectionalIterator first, BidirectionalIterator last);
template<class ExecutionPolicy, class BidirectionalIterator>
void reverse(ExecutionPolicy&& exec,
BidirectionalIterator first, BidirectionalIterator last);
Effects:
For each non-negative integer
i < (last - first) / 2,
applies
iter_swap
to all pairs of iterators
first + i, (last - i) - 1. Complexity:
Exactly
(last - first)/2
swaps
. template<class BidirectionalIterator, class OutputIterator>
OutputIterator
reverse_copy(BidirectionalIterator first, BidirectionalIterator last,
OutputIterator result);
template<class ExecutionPolicy, class BidirectionalIterator, class ForwardIterator>
ForwardIterator
reverse_copy(ExecutionPolicy&& exec,
BidirectionalIterator first, BidirectionalIterator last,
ForwardIterator result);
Requires:
The ranges
[first, last)
and
[result, result + (last - first))
shall not overlap
. Effects:
Copies the range
[first, last)
to the range
[result, result + (last - first))
such that
for every non-negative integer
i < (last - first)
the following assignment takes place:
*(result + (last - first) - 1 - i) = *(first + i). Returns:
result + (last - first). Complexity:
Exactly
last - first
assignments
.