Modernize std::count_if with ranges

This commit is contained in:
mitaclaw
2024-09-21 18:24:22 -07:00
parent c46060e298
commit 4cc5e1972a
3 changed files with 7 additions and 10 deletions

View File

@ -403,8 +403,7 @@ void StringPopBackIf(std::string* s, char c)
size_t StringUTF8CodePointCount(std::string_view str)
{
return str.size() -
std::count_if(str.begin(), str.end(), [](char c) -> bool { return (c & 0xC0) == 0x80; });
return str.size() - std::ranges::count_if(str, [](char c) -> bool { return (c & 0xC0) == 0x80; });
}
#ifdef _WIN32