1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

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.
This commit is contained in:
Andreas Kling 2020-03-03 16:01:37 +01:00
parent 058cd1241e
commit 686ade6b5a
14 changed files with 35 additions and 23 deletions

View file

@ -71,7 +71,7 @@ void AppletManager::add_applet(Window& applet)
{
m_applets.append(applet.make_weak_ptr());
quick_sort(m_applets.begin(), m_applets.end(), [](auto& a, auto& b) {
quick_sort(m_applets, [](auto& a, auto& b) {
auto index_a = order_vector.find_first_index(a->title());
auto index_b = order_vector.find_first_index(b->title());
ASSERT(index_a.has_value());