Modernize std::all_of with ranges

In DITSpecification.cpp, MaterialAsset.cpp, and ShaderAsset.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those.

In NetPlayClient.cpp, the non-trivial `NetPlay::Player` elements were being passed by value in `NetPlayClient::DoAllPlayersHaveGame()`. This has been fixed.

In WIABlob.cpp, the second example's predicate was returning the `std::optional` by value instead of implicitly converting it to a bool. This has been fixed.
This commit is contained in:
mitaclaw
2024-09-29 11:43:52 -07:00
parent 826e2bbf98
commit 860e6cf5cb
27 changed files with 42 additions and 51 deletions

View File

@ -44,7 +44,7 @@ std::string GetExpressionForControl(const std::string& control_name,
{
// If our expression contains any non-alpha characters
// we should quote it
if (!std::all_of(expr.begin(), expr.end(), Common::IsAlpha))
if (!std::ranges::all_of(expr, Common::IsAlpha))
expr = fmt::format("`{}`", expr);
}