mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Simplify std::stable_sort
with std::ranges::stable_partition
This commit is contained in:
@ -140,20 +140,14 @@ void ARCodeWidget::SortAlphabetically()
|
||||
|
||||
void ARCodeWidget::SortEnabledCodesFirst()
|
||||
{
|
||||
std::stable_sort(m_ar_codes.begin(), m_ar_codes.end(), [](const auto& a, const auto& b) {
|
||||
return a.enabled && a.enabled != b.enabled;
|
||||
});
|
||||
|
||||
std::ranges::stable_partition(m_ar_codes, std::identity{}, &ActionReplay::ARCode::enabled);
|
||||
UpdateList();
|
||||
SaveCodes();
|
||||
}
|
||||
|
||||
void ARCodeWidget::SortDisabledCodesFirst()
|
||||
{
|
||||
std::stable_sort(m_ar_codes.begin(), m_ar_codes.end(), [](const auto& a, const auto& b) {
|
||||
return !a.enabled && a.enabled != b.enabled;
|
||||
});
|
||||
|
||||
std::ranges::stable_partition(m_ar_codes, std::logical_not{}, &ActionReplay::ARCode::enabled);
|
||||
UpdateList();
|
||||
SaveCodes();
|
||||
}
|
||||
|
Reference in New Issue
Block a user