From e4fb837f4bf886e9688ea3c12e081a2d7b4e6a75 Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:09:34 -0700 Subject: Modernize `std::find_if` with ranges In BTEmu.cpp, `std::mem_fn` was not necessary for the predicate to compile. --- Source/Core/DiscIO/Blob.cpp | 4 ++-- Source/Core/DiscIO/RiivolutionPatcher.cpp | 2 +- Source/Core/DiscIO/VolumeVerifier.cpp | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'Source/Core/DiscIO') diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index 1109b00a1b..aa83504fd3 100644 --- a/Source/Core/DiscIO/Blob.cpp +++ b/Source/Core/DiscIO/Blob.cpp @@ -84,8 +84,8 @@ SectorReader::~SectorReader() const SectorReader::Cache* SectorReader::FindCacheLine(u64 block_num) { - auto itr = std::find_if(m_cache.begin(), m_cache.end(), - [&](const Cache& entry) { return entry.Contains(block_num); }); + auto itr = + std::ranges::find_if(m_cache, [&](const Cache& entry) { return entry.Contains(block_num); }); if (itr == m_cache.end()) return nullptr; diff --git a/Source/Core/DiscIO/RiivolutionPatcher.cpp b/Source/Core/DiscIO/RiivolutionPatcher.cpp index 8c54968c35..eff36077f9 100644 --- a/Source/Core/DiscIO/RiivolutionPatcher.cpp +++ b/Source/Core/DiscIO/RiivolutionPatcher.cpp @@ -366,7 +366,7 @@ static FSTBuilderNode* FindFileNodeInFST(std::string_view path, std::vectorbegin(), fst->end(), [&](const FSTBuilderNode& node) { + const auto it = std::ranges::find_if(*fst, [&](const FSTBuilderNode& node) { return Common::CaseInsensitiveEquals(node.m_filename, name); }); diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index 5a4a9c6856..e6da0fcc3e 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -472,8 +472,7 @@ std::vector VolumeVerifier::CheckPartitions() AddProblem(Severity::High, Common::GetStringT("The install partition is missing.")); if (ShouldHaveMasterpiecePartitions() && - types.cend() == - std::find_if(types.cbegin(), types.cend(), [](u32 type) { return type >= 0xFF; })) + types.cend() == std::ranges::find_if(types, [](u32 type) { return type >= 0xFF; })) { // i18n: This string is referring to a game mode in Super Smash Bros. Brawl called Masterpieces // where you play demos of NES/SNES/N64 games. Official translations: -- cgit v1.2.3