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:
mitaclaw
2024-09-21 14:43:21 -07:00
parent 1e5e9219cd
commit 62b2b939b5
20 changed files with 44 additions and 79 deletions

View File

@ -250,8 +250,7 @@ std::optional<BuildInfos> InitBuildInfos(const std::vector<TodoList::UpdateOp>&
const std::string& install_base_path,
const std::string& temp_dir)
{
const auto op_it = std::find_if(to_update.cbegin(), to_update.cend(),
[&](const auto& op) { return op.filename == "build_info.txt"; });
const auto op_it = std::ranges::find(to_update, "build_info.txt", &TodoList::UpdateOp::filename);
if (op_it == to_update.cend())
return {};