mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 00:45:46 +08:00
Ref T386, partial sort
This commit is contained in:
@@ -462,7 +462,7 @@ namespace BlackMisc
|
|||||||
//! In-place move the smallest n elements to the beginning and sort them.
|
//! In-place move the smallest n elements to the beginning and sort them.
|
||||||
template <class Predicate> void partiallySort(size_type n, Predicate p)
|
template <class Predicate> void partiallySort(size_type n, Predicate p)
|
||||||
{
|
{
|
||||||
std::partial_sort(begin(), begin() + n, end(), p);
|
std::partial_sort(begin(), begin() + std::min(n, size()), end(), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! In-place partially sort by some particular key(s).
|
//! In-place partially sort by some particular key(s).
|
||||||
|
|||||||
Reference in New Issue
Block a user