std::reverse
From cppreference.com
Defined in header <algorithm>
|
||
template< class BidirIt > void reverse( BidirIt first, BidirIt last ); |
(1) | (constexpr since C++20) |
template< class ExecutionPolicy, class BidirIt > void reverse( ExecutionPolicy&& policy, BidirIt first, BidirIt last ); |
(2) | (since C++17) |
1) Reverses the order of the elements in the range
[
first,
last)
. Behaves as if applying std::iter_swap to every pair of iterators first + i and (last - i) - 1 for each integer i in
[
0,
std::distance(first, last) / 2)
.2) Same as (1), but executed according to policy.
This overload participates in overload resolution only if all following conditions are satisfied:
std::is_execution_policy_v<std::decay_t<ExecutionPolicy>> is true. |
(until C++20) |