From 62b2b939b5825e48c89b8a3ebb97d9fc38cb59e5 Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:43:21 -0700 Subject: Simplify `std::find_if` with `std::ranges::find` and projections In LabelMap.cpp, the code is currently unused so I was unable to test it. In WiiUtils.cpp, the magic value `1u` was replaced by the constant value `DiscIO::PARTITION_UPDATE`. --- Source/Core/Common/Config/Config.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/Common/Config/Config.cpp') diff --git a/Source/Core/Common/Config/Config.cpp b/Source/Core/Common/Config/Config.cpp index 00dbab7bb4..b1e591ddac 100644 --- a/Source/Core/Common/Config/Config.cpp +++ b/Source/Core/Common/Config/Config.cpp @@ -11,6 +11,8 @@ #include #include +#include "Common/Projection.h" + namespace Config { using Layers = std::map>; @@ -168,8 +170,7 @@ const std::string& GetSystemName(System system) std::optional GetSystemFromName(const std::string& name) { - const auto system = std::find_if(system_to_name.begin(), system_to_name.end(), - [&name](const auto& entry) { return entry.second == name; }); + const auto system = std::ranges::find(system_to_name, name, Common::Projection::Value{}); if (system != system_to_name.end()) return system->first; -- cgit v1.2.3