From 8b1975ab189a39f2cf5503fff2dfc68087075547 Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sat, 5 Oct 2024 16:08:01 -0700 Subject: [PATCH] GraphicsMod: Simplify `std::sort` using ranges and projections --- .../VideoCommon/GraphicsModSystem/Config/GraphicsMod.cpp | 5 ----- .../Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.h | 2 -- .../GraphicsModSystem/Config/GraphicsModGroup.cpp | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.cpp index 76d1ad6af6..ef71ba6eb8 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.cpp @@ -330,8 +330,3 @@ void GraphicsModConfig::DeserializeFromProfile(const picojson::object& obj) } } } - -bool GraphicsModConfig::operator<(const GraphicsModConfig& other) const -{ - return m_weight < other.m_weight; -} diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.h b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.h index fd35b963dd..f845c612ad 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.h +++ b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsMod.h @@ -43,6 +43,4 @@ struct GraphicsModConfig void SerializeToProfile(picojson::object* value) const; void DeserializeFromProfile(const picojson::object& value); - - bool operator<(const GraphicsModConfig& other) const; }; diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp index 5fa2c011b6..3c234e9ec1 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp @@ -111,7 +111,7 @@ void GraphicsModGroupConfig::Load() try_add_mod(graphics_mod_directory, GraphicsModConfig::Source::System); } - std::sort(m_graphics_mods.begin(), m_graphics_mods.end()); + std::ranges::sort(m_graphics_mods, {}, &GraphicsModConfig::m_weight); for (auto& mod : m_graphics_mods) { m_path_to_graphics_mod[mod.GetAbsolutePath()] = &mod;