Merge pull request #13117 from mitaclaw/ranges-modernization-9-trivial-find

Ranges Algorithms Modernization - Find
This commit is contained in:
Tilka
2024-10-11 20:27:18 +01:00
committed by GitHub
32 changed files with 71 additions and 84 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;