1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

sort --merge works, but ignores --unique and --reverse

FileMerger receives Lines Iterables of the pre-sorted input files
via push_file() It implements Iterator, which yields lines from the
input files in (merged) sorted order. If the input files are not sorted,
then the behavior is undefined.

Internally, FileMerger uses a
std::collections::BinaryHeap<MergeableFile>.

MergeableFile is an internal helper that implements Ord in a way that
BinaryHeap can use (note that we want smallest-first, but BinaryHeap
returns largest first, so MergeableFile::cmp() calls reverse() on
whatever compare_by() returns.
This commit is contained in:
David Laban 2016-08-03 22:26:58 +01:00
parent 76abc7e51d
commit 8a8319a337
6 changed files with 130 additions and 7 deletions

View file

@ -0,0 +1,9 @@
1
2
3
4
5
6
7
8
9

View file

@ -0,0 +1,3 @@
1
4
7

View file

@ -0,0 +1,3 @@
2
5
8

View file

@ -0,0 +1,3 @@
3
6
9