diff --git a/Source/Core/DolphinQt/Config/ARCodeWidget.cpp b/Source/Core/DolphinQt/Config/ARCodeWidget.cpp index 933c6575ef..e7d44b8fe6 100644 --- a/Source/Core/DolphinQt/Config/ARCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/ARCodeWidget.cpp @@ -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(); } diff --git a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp index 0fc875401c..54ded43879 100644 --- a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp @@ -314,20 +314,14 @@ void GeckoCodeWidget::SortAlphabetically() void GeckoCodeWidget::SortEnabledCodesFirst() { - std::stable_sort(m_gecko_codes.begin(), m_gecko_codes.end(), [](const auto& a, const auto& b) { - return a.enabled && a.enabled != b.enabled; - }); - + std::ranges::stable_partition(m_gecko_codes, std::identity{}, &Gecko::GeckoCode::enabled); UpdateList(); SaveCodes(); } void GeckoCodeWidget::SortDisabledCodesFirst() { - std::stable_sort(m_gecko_codes.begin(), m_gecko_codes.end(), [](const auto& a, const auto& b) { - return !a.enabled && a.enabled != b.enabled; - }); - + std::ranges::stable_partition(m_gecko_codes, std::logical_not{}, &Gecko::GeckoCode::enabled); UpdateList(); SaveCodes(); }