std::partial_sort
From cppreference.com
Defined in header <algorithm>
|
||
template< class RandomIt > void partial_sort( RandomIt first, RandomIt middle, RandomIt last ); |
(1) | (constexpr since C++20) |
template< class ExecutionPolicy, class RandomIt > void partial_sort( ExecutionPolicy&& policy, |
(2) | (since C++17) |
template< class RandomIt, class Compare > void partial_sort( RandomIt first, RandomIt middle, RandomIt last, |
(3) | (constexpr since C++20) |
template< class ExecutionPolicy, class RandomIt, class Compare > void partial_sort( ExecutionPolicy&& policy, |
(4) | (since C++17) |
Rearranges elements such that the range [
first,
middle)
contains the sorted middle − first smallest elements in the range [
first,
last)
.
The order of equal elements is not guaranteed to be preserved. The order of the remaining elements in the range [
middle,
last)
is unspecified.
3) Elements are sorted with respect to comp.
2,4) Same as (1,3), but executed according to policy.
These overloads participate in overload resolution only if all following conditions are satisfied:
std::is_execution_policy_v<std::decay_t<ExecutionPolicy>> is true. |
(until C++20) |
std::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> is true. |
(since C++20) |
If any of the following conditions is satisfied, the behavior is undefined:
-
[
first,
middle)
or[
middle,
last)
is not a valid range.
|
(until C++11) |
|
(since C++11) |
Contents |
[edit] Parameters
first, last | - | the pair of iterators defining the |