diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-03 16:01:37 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-03 16:02:58 +0100 |
commit | 686ade6b5ad21aa7761025ed31a47bcee1ec1d3a (patch) | |
tree | 189ff4122bad989dfbc0606174e1de7f34e9370c /Userland/sort.cpp | |
parent | 058cd1241ec497911947266ef7e8f11d8bf8e5c7 (diff) | |
download | serenity-686ade6b5ad21aa7761025ed31a47bcee1ec1d3a.zip |
AK: Make quick_sort() a little more ergonomic
Now it actually defaults to "a < b" comparison, instead of forcing you
to provide a trivial less-than comparator. Also you can pass in any
collection type that has .begin() and .end() and we'll sort it for you.
Diffstat (limited to 'Userland/sort.cpp')
-rw-r--r-- | Userland/sort.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/sort.cpp b/Userland/sort.cpp index 1521344830..009069dca5 100644 --- a/Userland/sort.cpp +++ b/Userland/sort.cpp @@ -50,7 +50,7 @@ int main(int argc, char** argv) lines.append(buffer); } - quick_sort(lines.begin(), lines.end(), [](auto& a, auto& b) { + quick_sort(lines, [](auto& a, auto& b) { return strcmp(a.characters(), b.characters()) < 0; }); |