From 62b2b939b5825e48c89b8a3ebb97d9fc38cb59e5 Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:43:21 -0700 Subject: Simplify `std::find_if` with `std::ranges::find` and projections In LabelMap.cpp, the code is currently unused so I was unable to test it. In WiiUtils.cpp, the magic value `1u` was replaced by the constant value `DiscIO::PARTITION_UPDATE`. --- Source/Core/UICommon/GameFileCache.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Source/Core/UICommon/GameFileCache.cpp') diff --git a/Source/Core/UICommon/GameFileCache.cpp b/Source/Core/UICommon/GameFileCache.cpp index d5b970d29c..90dd0c63fc 100644 --- a/Source/Core/UICommon/GameFileCache.cpp +++ b/Source/Core/UICommon/GameFileCache.cpp @@ -65,9 +65,7 @@ void GameFileCache::Clear(DeleteOnDisk delete_on_disk) std::shared_ptr GameFileCache::AddOrGet(const std::string& path, bool* cache_changed) { - auto it = std::find_if( - m_cached_files.begin(), m_cached_files.end(), - [&path](const std::shared_ptr& file) { return file->GetFilePath() == path; }); + auto it = std::ranges::find(m_cached_files, path, &GameFile::GetFilePath); const bool found = it != m_cached_files.cend(); if (!found) { -- cgit v1.2.3