|
inline |
lazy_sort_by with key_fn = by::identity
impl::lazy_sort_by<F> rangeless::fn::lazy_sort_by | ( | F | key_fn | ) |
Unstable lazy sort.
Initially move all inputs into a std::vector
and heapify in O(n)
, and then lazily yield elements with pop_heap
in O(log(n))
. This is more efficient if the downstream stage is expected to consume a small fraction of sorted inputs.
Buffering space requirements for seq
: O(N)
.
|
inline |
|
inline |
sort_by with key_fn = by::identity
impl::sort_by<F, impl::stable_sort_tag> rangeless::fn::sort_by | ( | F | key_fn | ) |
stable-sort and return the input.
Buffering space requirements for seq
: O(N)
.
|
inline |
impl::take_top_n_by<F> rangeless::fn::take_top_n_by | ( | size_t | n, |
F | key_fn | ||
) |
Return top-n elements, sorted by key_fn.
This is conceptually similar to fn::sort_by(key_fn) % fn::take_last(n)
, but is more efficient: the implementation mantains a priority-queue of top-n max-elements encountered so-far.
Buffering space requirements: O(n)
; time complexity: O(N*log(n))
|
inline |
impl::sort_by<F, impl::unstable_sort_tag> rangeless::fn::unstable_sort_by | ( | F | key_fn | ) |