mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-02 17:28:33 +00:00
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`.
This commit is contained in:
parent
1e5e9219cd
commit
62b2b939b5
20 changed files with 44 additions and 79 deletions
|
@ -11,6 +11,8 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Projection.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
using Layers = std::map<LayerType, std::shared_ptr<Layer>>;
|
||||
|
@ -168,8 +170,7 @@ const std::string& GetSystemName(System system)
|
|||
|
||||
std::optional<System> 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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue