summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ARCodeWidget.cpp
diff options
context:
space:
mode:
authormitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-09-28 22:17:12 -0700
committermitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-10-09 17:26:10 -0700
commit519da8297ce892f9edc215806bb641a6003d623d (patch)
treef83ae5829a67214ef85e8c3058f00f0ce25160d1 /Source/Core/DolphinQt/Config/ARCodeWidget.cpp
parente6f93efac4c47c9281c98ad426e54e6fa5e4b0c7 (diff)
Simplify `std::stable_sort` with `std::ranges::stable_partition`
Diffstat (limited to 'Source/Core/DolphinQt/Config/ARCodeWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/ARCodeWidget.cpp10
1 files changed, 2 insertions, 8 deletions
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();
}