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

@ -1372,8 +1372,8 @@ WIARVZFileReader<RVZ>::ProcessAndCompress(CompressThreadState* state, CompressPa
TryReuse(reusable_groups, reusable_groups_mutex, &entry);
if (!entry.reused_group && reuse_id)
{
const auto it = std::find_if(output_entries.begin(), output_entries.begin() + i,
[reuse_id](const auto& e) { return e.reuse_id == reuse_id; });
const auto it = std::ranges::find(output_entries.begin(), output_entries.begin() + i,
reuse_id, &OutputParametersEntry::reuse_id);
if (it != output_entries.begin() + i)
entry.reused_group = it->reused_group;
}