mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
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.
This commit is contained in:
@ -91,7 +91,7 @@ void MemoryPatches::DisablePatch(const Core::CPUThreadGuard& guard, std::size_t
|
||||
|
||||
bool MemoryPatches::HasEnabledPatch(u32 address) const
|
||||
{
|
||||
return std::any_of(m_patches.begin(), m_patches.end(), [address](const MemoryPatch& patch) {
|
||||
return std::ranges::any_of(m_patches, [address](const MemoryPatch& patch) {
|
||||
return patch.address == address && patch.is_enabled == MemoryPatch::State::Enabled;
|
||||
});
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ void Watches::DisableWatch(std::size_t index)
|
||||
|
||||
bool Watches::HasEnabledWatch(u32 address) const
|
||||
{
|
||||
return std::any_of(m_watches.begin(), m_watches.end(), [address](const auto& watch) {
|
||||
return std::ranges::any_of(m_watches, [address](const auto& watch) {
|
||||
return watch.address == address && watch.is_enabled == Watch::State::Enabled;
|
||||
});
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
|
||||
// N.B. This avoids doing any copies
|
||||
auto ext_matches = [&native_exts](const fs::path& path) {
|
||||
const std::basic_string_view<fs::path::value_type> native_path = path.native();
|
||||
return std::any_of(native_exts.cbegin(), native_exts.cend(), [&native_path](const auto& ext) {
|
||||
return std::ranges::any_of(native_exts, [&native_path](const auto& ext) {
|
||||
const auto compare_len = ext.native().length();
|
||||
if (native_path.length() < compare_len)
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user