From 140252ffc0ae71e8b5309bff7d6550189c602702 Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:26:50 -0700 Subject: Modernize `std::any_of` with ranges In WiimoteReal.cpp, JitRegCache.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those. In ConvertDialog.cpp, the `std::mem_fn` helper was removed because ranges algorithms are able to handle pointers to member functions as predicates. --- Source/Core/DiscIO/VolumeVerifier.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Source/Core/DiscIO/VolumeVerifier.cpp') diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index d510aa3266..552b20cfb4 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -729,16 +729,15 @@ bool VolumeVerifier::ShouldHaveInstallPartition() const static constexpr std::array dragon_quest_x = {"S4MJGD", "S4SJGD", "S6TJGD", "SDQJGD"}; const std::string& game_id = m_volume.GetGameID(); - return std::any_of(dragon_quest_x.cbegin(), dragon_quest_x.cend(), - [&game_id](std::string_view x) { return x == game_id; }); + return std::ranges::any_of(dragon_quest_x, + [&game_id](std::string_view x) { return x == game_id; }); } bool VolumeVerifier::ShouldHaveMasterpiecePartitions() const { static constexpr std::array ssbb = {"RSBE01", "RSBJ01", "RSBK01", "RSBP01"}; const std::string& game_id = m_volume.GetGameID(); - return std::any_of(ssbb.cbegin(), ssbb.cend(), - [&game_id](std::string_view x) { return x == game_id; }); + return std::ranges::any_of(ssbb, [&game_id](std::string_view x) { return x == game_id; }); } bool VolumeVerifier::ShouldBeDualLayer() const @@ -1039,7 +1038,7 @@ void VolumeVerifier::CheckSuperPaperMario() if (!m_volume.Read(offset, length, data.data(), partition)) return; - if (std::any_of(data.cbegin(), data.cend(), [](u8 x) { return x != 0; })) + if (std::ranges::any_of(data, [](u8 x) { return x != 0; })) { AddProblem(Severity::High, Common::GetStringT("Some padding data that should be zero is not zero. " -- cgit v1.2.3