mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
Simplify std::stable_sort
with std::ranges::stable_partition
This commit is contained in:
parent
e6f93efac4
commit
519da8297c
@ -140,20 +140,14 @@ void ARCodeWidget::SortAlphabetically()
|
|||||||
|
|
||||||
void ARCodeWidget::SortEnabledCodesFirst()
|
void ARCodeWidget::SortEnabledCodesFirst()
|
||||||
{
|
{
|
||||||
std::stable_sort(m_ar_codes.begin(), m_ar_codes.end(), [](const auto& a, const auto& b) {
|
std::ranges::stable_partition(m_ar_codes, std::identity{}, &ActionReplay::ARCode::enabled);
|
||||||
return a.enabled && a.enabled != b.enabled;
|
|
||||||
});
|
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
SaveCodes();
|
SaveCodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARCodeWidget::SortDisabledCodesFirst()
|
void ARCodeWidget::SortDisabledCodesFirst()
|
||||||
{
|
{
|
||||||
std::stable_sort(m_ar_codes.begin(), m_ar_codes.end(), [](const auto& a, const auto& b) {
|
std::ranges::stable_partition(m_ar_codes, std::logical_not{}, &ActionReplay::ARCode::enabled);
|
||||||
return !a.enabled && a.enabled != b.enabled;
|
|
||||||
});
|
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
SaveCodes();
|
SaveCodes();
|
||||||
}
|
}
|
||||||
|
@ -314,20 +314,14 @@ void GeckoCodeWidget::SortAlphabetically()
|
|||||||
|
|
||||||
void GeckoCodeWidget::SortEnabledCodesFirst()
|
void GeckoCodeWidget::SortEnabledCodesFirst()
|
||||||
{
|
{
|
||||||
std::stable_sort(m_gecko_codes.begin(), m_gecko_codes.end(), [](const auto& a, const auto& b) {
|
std::ranges::stable_partition(m_gecko_codes, std::identity{}, &Gecko::GeckoCode::enabled);
|
||||||
return a.enabled && a.enabled != b.enabled;
|
|
||||||
});
|
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
SaveCodes();
|
SaveCodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeckoCodeWidget::SortDisabledCodesFirst()
|
void GeckoCodeWidget::SortDisabledCodesFirst()
|
||||||
{
|
{
|
||||||
std::stable_sort(m_gecko_codes.begin(), m_gecko_codes.end(), [](const auto& a, const auto& b) {
|
std::ranges::stable_partition(m_gecko_codes, std::logical_not{}, &Gecko::GeckoCode::enabled);
|
||||||
return !a.enabled && a.enabled != b.enabled;
|
|
||||||
});
|
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
SaveCodes();
|
SaveCodes();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user