diff options
| author | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-09-20 22:18:04 -0700 |
|---|---|---|
| committer | mitaclaw <140017135+mitaclaw@users.noreply.github.com> | 2024-10-10 15:28:11 -0700 |
| commit | 6ca7e2856bd704a687e8408bf7ed92b23672c7fa (patch) | |
| tree | 44cb8454446e47555437543a069a106b8295e3f9 /Source/Core | |
| parent | b5f7a508742671410c44fc6f0e66d0ce789c3b57 (diff) | |
Modernize `std::find` with ranges
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Common/IniFile.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/Core/Config/DefaultLocale.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/Core/Debugger/CodeTrace.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/Core/PatchEngine.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/UICommon/ResourcePack/Manager.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 2 |
7 files changed, 10 insertions, 10 deletions
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index a7ce26976b..b345f6c0fe 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -85,7 +85,7 @@ bool IniFile::Section::Delete(std::string_view key) return false; values.erase(it); - keys_order.erase(std::find(keys_order.begin(), keys_order.end(), key)); + keys_order.erase(std::ranges::find(keys_order, key)); return true; } diff --git a/Source/Core/Core/Config/DefaultLocale.cpp b/Source/Core/Core/Config/DefaultLocale.cpp index 1cf6a2e941..82daf804cc 100644 --- a/Source/Core/Core/Config/DefaultLocale.cpp +++ b/Source/Core/Core/Config/DefaultLocale.cpp @@ -59,7 +59,7 @@ static std::optional<DiscIO::Language> TryParseLanguage(const std::string& local "ja", "en", "de", "fr", "es", "it", "nl", "zh", "zh", "ko", }; - const auto it = std::find(LANGUAGES.cbegin(), LANGUAGES.cend(), split_locale[0]); + const auto it = std::ranges::find(LANGUAGES, split_locale[0]); if (it == LANGUAGES.cend()) return std::nullopt; @@ -142,7 +142,7 @@ static std::optional<u8> ComputeDefaultCountry() if (country == "BQ" || country == "CW" || country == "SX") country = "AN"; - const auto it = std::find(COUNTRIES.cbegin(), COUNTRIES.cend(), country); + const auto it = std::ranges::find(COUNTRIES, country); if (it == COUNTRIES.cend()) return std::nullopt; diff --git a/Source/Core/Core/Debugger/CodeTrace.cpp b/Source/Core/Core/Debugger/CodeTrace.cpp index 9036213324..bf3a804db5 100644 --- a/Source/Core/Core/Debugger/CodeTrace.cpp +++ b/Source/Core/Core/Debugger/CodeTrace.cpp @@ -252,7 +252,7 @@ HitType CodeTrace::TraceLogic(const TraceOutput& current_instr, bool first_hit) return HitType::SKIP; // The reg_itr will be used later for erasing. - auto reg_itr = std::find(m_reg_autotrack.begin(), m_reg_autotrack.end(), instr.reg0); + auto reg_itr = std::ranges::find(m_reg_autotrack, instr.reg0); const bool match_reg123 = (!instr.reg1.empty() && std::find(m_reg_autotrack.begin(), m_reg_autotrack.end(), instr.reg1) != m_reg_autotrack.end()) || diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp index 0728637e47..16be2960ba 100644 --- a/Source/Core/Core/PatchEngine.cpp +++ b/Source/Core/Core/PatchEngine.cpp @@ -77,7 +77,7 @@ std::optional<PatchEntry> DeserializeLine(std::string line) entry.conditional = true; } - const auto iter = std::find(s_patch_type_strings.begin(), s_patch_type_strings.end(), items[1]); + const auto iter = std::ranges::find(s_patch_type_strings, items[1]); if (iter == s_patch_type_strings.end()) return std::nullopt; entry.type = static_cast<PatchType>(std::distance(s_patch_type_strings.begin(), iter)); diff --git a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp index 0fc875401c..76a6d11cdd 100644 --- a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp @@ -396,7 +396,7 @@ void GeckoCodeWidget::DownloadCodes() for (const auto& code : codes) { - auto it = std::find(m_gecko_codes.begin(), m_gecko_codes.end(), code); + auto it = std::ranges::find(m_gecko_codes, code); if (it == m_gecko_codes.end()) { diff --git a/Source/Core/UICommon/ResourcePack/Manager.cpp b/Source/Core/UICommon/ResourcePack/Manager.cpp index d57cbb498a..eda0e9c93b 100644 --- a/Source/Core/UICommon/ResourcePack/Manager.cpp +++ b/Source/Core/UICommon/ResourcePack/Manager.cpp @@ -85,7 +85,7 @@ std::vector<ResourcePack>& GetPacks() std::vector<ResourcePack*> GetLowerPriorityPacks(const ResourcePack& pack) { std::vector<ResourcePack*> list; - for (auto it = std::find(packs.begin(), packs.end(), pack) + 1; it != packs.end(); ++it) + for (auto it = std::ranges::find(packs, pack) + 1; it != packs.end(); ++it) { auto& entry = *it; if (!IsInstalled(pack)) @@ -100,7 +100,7 @@ std::vector<ResourcePack*> GetLowerPriorityPacks(const ResourcePack& pack) std::vector<ResourcePack*> GetHigherPriorityPacks(const ResourcePack& pack) { std::vector<ResourcePack*> list; - auto end = std::find(packs.begin(), packs.end(), pack); + auto end = std::ranges::find(packs, pack); for (auto it = packs.begin(); it != end; ++it) { @@ -145,7 +145,7 @@ bool Remove(ResourcePack& pack) if (!result) return false; - auto pack_iterator = std::find(packs.begin(), packs.end(), pack); + auto pack_iterator = std::ranges::find(packs, pack); if (pack_iterator == packs.end()) return false; diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index b99533eb02..a624734d60 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -2814,7 +2814,7 @@ TextureCacheBase::InvalidateTexture(TexAddrCache::iterator iter, bool discard_pe // Xenoblade's sunset scene, where 35 copies are done per frame, and 25 of them are // copied to the same address, and can be skipped. ReleaseEFBCopyStagingTexture(std::move(entry->pending_efb_copy)); - auto pending_it = std::find(m_pending_efb_copies.begin(), m_pending_efb_copies.end(), entry); + auto pending_it = std::ranges::find(m_pending_efb_copies, entry); if (pending_it != m_pending_efb_copies.end()) m_pending_efb_copies.erase(pending_it); } |
