mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:05:08 +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:
parent
058cd1241e
commit
686ade6b5a
14 changed files with 35 additions and 23 deletions
|
@ -71,7 +71,7 @@ void GFontDatabase::for_each_font(Function<void(const StringView&)> callback)
|
|||
names.ensure_capacity(m_name_to_metadata.size());
|
||||
for (auto& it : m_name_to_metadata)
|
||||
names.append(it.key);
|
||||
quick_sort(names.begin(), names.end(), AK::is_less_than<String>);
|
||||
quick_sort(names);
|
||||
for (auto& name : names)
|
||||
callback(name);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void GFontDatabase::for_each_fixed_width_font(Function<void(const StringView&)>
|
|||
if (it.value.is_fixed_width)
|
||||
names.append(it.key);
|
||||
}
|
||||
quick_sort(names.begin(), names.end(), AK::is_less_than<String>);
|
||||
quick_sort(names);
|
||||
for (auto& name : names)
|
||||
callback(name);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue