mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +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
|
@ -542,7 +542,7 @@ void IRCClient::handle_rpl_namreply(const Message& msg)
|
|||
auto& channel = ensure_channel(channel_name);
|
||||
auto members = msg.arguments[3].split(' ');
|
||||
|
||||
quick_sort(members.begin(), members.end(), [](auto& a, auto& b) {
|
||||
quick_sort(members, [](auto& a, auto& b) {
|
||||
return strcasecmp(a.characters(), b.characters()) < 0;
|
||||
});
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
|||
Vector<String> sorted_app_categories;
|
||||
for (auto& category : seen_app_categories)
|
||||
sorted_app_categories.append(category);
|
||||
quick_sort(sorted_app_categories.begin(), sorted_app_categories.end(), [](auto& a, auto& b) { return a < b; });
|
||||
quick_sort(sorted_app_categories);
|
||||
|
||||
u8 system_menu_name[] = { 0xc3, 0xb8, 0 };
|
||||
auto system_menu = GUI::Menu::construct(String((const char*)system_menu_name));
|
||||
|
@ -175,7 +175,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
|||
auto theme_path = String::format("/res/themes/%s", theme_name.characters());
|
||||
g_themes.append({ FileSystemPath(theme_name).title(), theme_path });
|
||||
}
|
||||
quick_sort(g_themes.begin(), g_themes.end(), [](auto& a, auto& b) { return a.name < b.name; });
|
||||
quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; });
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue