Modernize std::find_if with ranges

In BTEmu.cpp, `std::mem_fn` was not necessary for the predicate to compile.
This commit is contained in:
mitaclaw
2024-09-21 18:09:34 -07:00
parent 6ca7e2856b
commit e4fb837f4b
24 changed files with 60 additions and 72 deletions

View File

@ -170,10 +170,9 @@ bool ResourcePack::Install(const std::string& path)
continue;
const std::string texture_name = texture_zip_path.substr(texture_zip_path_prefix.size());
auto texture_it = std::find_if(
m_textures.cbegin(), m_textures.cend(), [&texture_name](const std::string& texture) {
return mz_path_compare_wc(texture.c_str(), texture_name.c_str(), 1) == MZ_OK;
});
auto texture_it = std::ranges::find_if(m_textures, [&texture_name](const std::string& texture) {
return mz_path_compare_wc(texture.c_str(), texture_name.c_str(), 1) == MZ_OK;
});
if (texture_it == m_textures.cend())
continue;
const auto texture = *texture_it;