summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authormitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-09-30 17:26:50 -0700
committermitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-12-15 19:54:16 -0800
commit140252ffc0ae71e8b5309bff7d6550189c602702 (patch)
tree7e6fe317fc93e0d9fc91e089ec3af86af25565f1 /Source
parent860e6cf5cb7d96499aecf6f6067783bdb71c29ad (diff)
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.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/Debug/MemoryPatches.cpp2
-rw-r--r--Source/Core/Common/Debug/Watches.cpp2
-rw-r--r--Source/Core/Common/FileSearch.cpp2
-rw-r--r--Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp5
-rw-r--r--Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp7
-rw-r--r--Source/Core/Core/Debugger/CodeTrace.cpp4
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCMemcard.cpp10
-rw-r--r--Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp3
-rw-r--r--Source/Core/Core/IOS/ES/TitleManagement.cpp6
-rw-r--r--Source/Core/Core/IOS/FS/FileSystemCommon.cpp2
-rw-r--r--Source/Core/Core/IOS/FS/HostBackend/FS.cpp4
-rw-r--r--Source/Core/Core/IOS/Network/KD/Mail/WC24FriendList.cpp4
-rw-r--r--Source/Core/Core/IOS/USB/Common.cpp2
-rw-r--r--Source/Core/Core/IOS/USB/OH0/OH0.cpp2
-rw-r--r--Source/Core/Core/IOS/VersionInfo.cpp6
-rw-r--r--Source/Core/Core/IOS/WFS/WFSSRV.cpp4
-rw-r--r--Source/Core/Core/NetPlayClient.cpp4
-rw-r--r--Source/Core/Core/NetPlayServer.cpp4
-rw-r--r--Source/Core/Core/PowerPC/BreakPoints.cpp2
-rw-r--r--Source/Core/Core/PowerPC/Expression.cpp7
-rw-r--r--Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp3
-rw-r--r--Source/Core/Core/PowerPC/JitCommon/JitBase.cpp2
-rw-r--r--Source/Core/Core/PowerPC/PPCAnalyst.cpp2
-rw-r--r--Source/Core/Core/WiiUtils.cpp11
-rw-r--r--Source/Core/DiscIO/VolumeVerifier.cpp9
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp5
-rw-r--r--Source/Core/DolphinQt/ConvertDialog.cpp4
-rw-r--r--Source/Core/DolphinQt/Settings/AudioPane.cpp3
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp4
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp8
-rw-r--r--Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp4
-rw-r--r--Source/Core/VideoBackends/OGL/OGLGfx.cpp4
-rw-r--r--Source/Core/VideoBackends/Vulkan/VulkanContext.cpp4
-rw-r--r--Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp6
34 files changed, 69 insertions, 82 deletions
diff --git a/Source/Core/Common/Debug/MemoryPatches.cpp b/Source/Core/Common/Debug/MemoryPatches.cpp
index d4f7e92379..3dee4d0e03 100644
--- a/Source/Core/Common/Debug/MemoryPatches.cpp
+++ b/Source/Core/Common/Debug/MemoryPatches.cpp
@@ -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;
});
}
diff --git a/Source/Core/Common/Debug/Watches.cpp b/Source/Core/Common/Debug/Watches.cpp
index beeab99086..2ffad54b82 100644
--- a/Source/Core/Common/Debug/Watches.cpp
+++ b/Source/Core/Common/Debug/Watches.cpp
@@ -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;
});
}
diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp
index 4a54c978c9..ac82b9ebd6 100644
--- a/Source/Core/Common/FileSearch.cpp
+++ b/Source/Core/Common/FileSearch.cpp
@@ -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;
diff --git a/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp
index 88fa7c0696..d41c73958d 100644
--- a/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp
+++ b/Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp
@@ -114,9 +114,8 @@ public:
for (const auto& value : section_map)
{
const Config::Location location{system.first, section_name, value.first};
- const bool load_disallowed =
- std::any_of(begin(s_setting_disallowed), end(s_setting_disallowed),
- [&location](const Config::Location* l) { return *l == location; });
+ const bool load_disallowed = std::ranges::any_of(
+ s_setting_disallowed, [&location](const auto* l) { return *l == location; });
if (load_disallowed)
continue;
diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
index 4e4b698851..0a0230d697 100644
--- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
+++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
@@ -27,9 +27,8 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::WIIMOTE_BB_SOURCE.GetLocation(),
};
- return std::any_of(begin(s_setting_saveable), end(s_setting_saveable),
- [&config_location](const Config::Location* location) {
- return *location == config_location;
- });
+ return std::ranges::any_of(s_setting_saveable, [&config_location](const auto* location) {
+ return *location == config_location;
+ });
}
} // namespace ConfigLoaders
diff --git a/Source/Core/Core/Debugger/CodeTrace.cpp b/Source/Core/Core/Debugger/CodeTrace.cpp
index bf3a804db5..b92bc246eb 100644
--- a/Source/Core/Core/Debugger/CodeTrace.cpp
+++ b/Source/Core/Core/Debugger/CodeTrace.cpp
@@ -267,8 +267,8 @@ HitType CodeTrace::TraceLogic(const TraceOutput& current_instr, bool first_hit)
// Checks if the intstruction is a type that needs special handling.
const auto CompareInstruction = [](std::string_view instruction, const auto& type_compare) {
- return std::any_of(type_compare.begin(), type_compare.end(),
- [&instruction](std::string_view s) { return instruction.starts_with(s); });
+ return std::ranges::any_of(
+ type_compare, [&instruction](std::string_view s) { return instruction.starts_with(s); });
};
// Exclusions from updating tracking logic. mt operations are too complex and specialized.
diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
index 0017cd6162..8d8cfb77ff 100644
--- a/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
+++ b/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
@@ -101,8 +101,8 @@ std::pair<GCMemcardErrorCode, std::optional<GCMemcard>> GCMemcard::Open(std::str
MBIT_SIZE_MEMORY_CARD_2043,
}};
- if (!std::any_of(valid_megabits.begin(), valid_megabits.end(),
- [filesize_megabits](u64 mbits) { return mbits == filesize_megabits; }))
+ if (!std::ranges::any_of(valid_megabits,
+ [filesize_megabits](u64 mbits) { return mbits == filesize_megabits; }))
{
error_code.Set(GCMemcardValidityIssues::INVALID_CARD_SIZE);
return std::make_pair(error_code, std::nullopt);
@@ -1296,8 +1296,8 @@ GCMemcardErrorCode Header::CheckForErrors(u16 card_size_mbits) const
error_code.Set(GCMemcardValidityIssues::MISMATCHED_CARD_SIZE);
// unused areas, should always be filled with 0xFF
- if (std::any_of(m_unused_1.begin(), m_unused_1.end(), [](u8 val) { return val != 0xFF; }) ||
- std::any_of(m_unused_2.begin(), m_unused_2.end(), [](u8 val) { return val != 0xFF; }))
+ if (std::ranges::any_of(m_unused_1, [](u8 val) { return val != 0xFF; }) ||
+ std::ranges::any_of(m_unused_2, [](u8 val) { return val != 0xFF; }))
{
error_code.Set(GCMemcardValidityIssues::DATA_IN_UNUSED_AREA);
}
@@ -1361,7 +1361,7 @@ GCMemcardErrorCode Directory::CheckForErrors() const
error_code.Set(GCMemcardValidityIssues::INVALID_CHECKSUM);
// unused area, should always be filled with 0xFF
- if (std::any_of(m_padding.begin(), m_padding.end(), [](u8 val) { return val != 0xFF; }))
+ if (std::ranges::any_of(m_padding, [](u8 val) { return val != 0xFF; }))
error_code.Set(GCMemcardValidityIssues::DATA_IN_UNUSED_AREA);
return error_code;
diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
index 18cc6e4a37..22a014d619 100644
--- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
@@ -613,8 +613,7 @@ void WiimoteScanner::SetScanMode(WiimoteScanMode scan_mode)
bool WiimoteScanner::IsReady() const
{
std::lock_guard lg(m_backends_mutex);
- return std::any_of(m_backends.begin(), m_backends.end(),
- [](const auto& backend) { return backend->IsReady(); });
+ return std::ranges::any_of(m_backends, &WiimoteScannerBackend::IsReady);
}
static void CheckForDisconnectedWiimotes()
diff --git a/Source/Core/Core/IOS/ES/TitleManagement.cpp b/Source/Core/Core/IOS/ES/TitleManagement.cpp
index e0d72af983..25e4f3ad66 100644
--- a/Source/Core/Core/IOS/ES/TitleManagement.cpp
+++ b/Source/Core/Core/IOS/ES/TitleManagement.cpp
@@ -878,7 +878,7 @@ ReturnCode ESCore::DeleteSharedContent(const std::array<u8, 20>& sha1) const
// Check whether the shared content is used by a system title.
const std::vector<u64> titles = GetInstalledTitles();
- const bool is_used_by_system_title = std::any_of(titles.begin(), titles.end(), [&](u64 id) {
+ const bool is_used_by_system_title = std::ranges::any_of(titles, [&](u64 id) {
if (!ES::IsTitleType(id, ES::TitleType::System))
return false;
@@ -887,8 +887,8 @@ ReturnCode ESCore::DeleteSharedContent(const std::array<u8, 20>& sha1) const
return true;
const auto contents = tmd.GetContents();
- return std::any_of(contents.begin(), contents.end(),
- [&sha1](const auto& content) { return content.sha1 == sha1; });
+ return std::ranges::any_of(contents,
+ [&sha1](const auto& content) { return content.sha1 == sha1; });
});
// Any shared content used by a system title cannot be deleted.
diff --git a/Source/Core/Core/IOS/FS/FileSystemCommon.cpp b/Source/Core/Core/IOS/FS/FileSystemCommon.cpp
index 1ec5dbe068..571f22a529 100644
--- a/Source/Core/Core/IOS/FS/FileSystemCommon.cpp
+++ b/Source/Core/Core/IOS/FS/FileSystemCommon.cpp
@@ -26,7 +26,7 @@ bool IsValidNonRootPath(std::string_view path)
bool IsValidFilename(std::string_view filename)
{
return filename.length() <= MaxFilenameLength &&
- !std::any_of(filename.begin(), filename.end(), [](char c) { return c == '/'; });
+ !std::ranges::any_of(filename, [](char c) { return c == '/'; });
}
SplitPathResult SplitPathAndBasename(std::string_view path)
diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp
index f5c6794bc7..c26cb7ee74 100644
--- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp
+++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp
@@ -515,14 +515,14 @@ ResultCode HostFileSystem::CreateDirectory(Uid uid, Gid gid, const std::string&
bool HostFileSystem::IsFileOpened(const std::string& path) const
{
- return std::any_of(m_handles.begin(), m_handles.end(), [&path](const Handle& handle) {
+ return std::ranges::any_of(m_handles, [&path](const Handle& handle) {
return handle.opened && handle.wii_path == path;
});
}
bool HostFileSystem::IsDirectoryInUse(const std::string& path) const
{
- return std::any_of(m_handles.begin(), m_handles.end(), [&path](const Handle& handle) {
+ return std::ranges::any_of(m_handles, [&path](const Handle& handle) {
return handle.opened && handle.wii_path.starts_with(path);
});
}
diff --git a/Source/Core/Core/IOS/Network/KD/Mail/WC24FriendList.cpp b/Source/Core/Core/IOS/Network/KD/Mail/WC24FriendList.cpp
index 6c6b7852f8..b150665907 100644
--- a/Source/Core/Core/IOS/Network/KD/Mail/WC24FriendList.cpp
+++ b/Source/Core/Core/IOS/Network/KD/Mail/WC24FriendList.cpp
@@ -58,8 +58,8 @@ bool WC24FriendList::CheckFriendList() const
bool WC24FriendList::DoesFriendExist(u64 friend_id) const
{
- return std::any_of(m_data.friend_codes.cbegin(), m_data.friend_codes.cend(),
- [&friend_id](const u64 v) { return v == friend_id; });
+ return std::ranges::any_of(m_data.friend_codes,
+ [&friend_id](const u64 v) { return v == friend_id; });
}
std::vector<u64> WC24FriendList::GetUnconfirmedFriends() const
diff --git a/Source/Core/Core/IOS/USB/Common.cpp b/Source/Core/Core/IOS/USB/Common.cpp
index 30a01b5dae..1eebbeb1c0 100644
--- a/Source/Core/Core/IOS/USB/Common.cpp
+++ b/Source/Core/Core/IOS/USB/Common.cpp
@@ -74,7 +74,7 @@ bool Device::HasClass(const u8 device_class) const
if (GetDeviceDescriptor().bDeviceClass == device_class)
return true;
const auto interfaces = GetInterfaces(0);
- return std::any_of(interfaces.begin(), interfaces.end(), [device_class](const auto& interface) {
+ return std::ranges::any_of(interfaces, [device_class](const auto& interface) {
return interface.bInterfaceClass == device_class;
});
}
diff --git a/Source/Core/Core/IOS/USB/OH0/OH0.cpp b/Source/Core/Core/IOS/USB/OH0/OH0.cpp
index fdd6b40d9c..a2be34727b 100644
--- a/Source/Core/Core/IOS/USB/OH0/OH0.cpp
+++ b/Source/Core/Core/IOS/USB/OH0/OH0.cpp
@@ -234,7 +234,7 @@ std::optional<IPCReply> OH0::RegisterClassChangeHook(const IOCtlVRequest& reques
bool OH0::HasDeviceWithVidPid(const u16 vid, const u16 pid) const
{
- return std::any_of(m_devices.begin(), m_devices.end(), [=](const auto& device) {
+ return std::ranges::any_of(m_devices, [=](const auto& device) {
return device.second->GetVid() == vid && device.second->GetPid() == pid;
});
}
diff --git a/Source/Core/Core/IOS/VersionInfo.cpp b/Source/Core/Core/IOS/VersionInfo.cpp
index 8da85d2ebc..8582aad10e 100644
--- a/Source/Core/Core/IOS/VersionInfo.cpp
+++ b/Source/Core/Core/IOS/VersionInfo.cpp
@@ -380,9 +380,9 @@ bool IsEmulated(u32 major_version)
if (major_version == static_cast<u32>(Titles::BC & 0xffffffff))
return true;
- return std::any_of(
- ios_memory_values.begin(), ios_memory_values.end(),
- [major_version](const MemoryValues& values) { return values.ios_number == major_version; });
+ return std::ranges::any_of(ios_memory_values, [major_version](const MemoryValues& values) {
+ return values.ios_number == major_version;
+ });
}
bool IsEmulated(u64 title_id)
diff --git a/Source/Core/Core/IOS/WFS/WFSSRV.cpp b/Source/Core/Core/IOS/WFS/WFSSRV.cpp
index b6a00fd2eb..2e3fadc882 100644
--- a/Source/Core/Core/IOS/WFS/WFSSRV.cpp
+++ b/Source/Core/Core/IOS/WFS/WFSSRV.cpp
@@ -375,8 +375,8 @@ s32 WFSSRVDevice::Rename(std::string source, std::string dest) const
INFO_LOG_FMT(IOS_WFS, "IOCTL_WFS_RENAME: {} to {}", source, dest);
- const bool opened = std::any_of(m_fds.begin(), m_fds.end(),
- [&](const auto& fd) { return fd.in_use && fd.path == source; });
+ const bool opened =
+ std::ranges::any_of(m_fds, [&](const auto& fd) { return fd.in_use && fd.path == source; });
if (opened)
return WFS_FILE_IS_OPENED;
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp
index 14b43907ef..b9c859915c 100644
--- a/Source/Core/Core/NetPlayClient.cpp
+++ b/Source/Core/Core/NetPlayClient.cpp
@@ -2486,8 +2486,8 @@ bool NetPlayClient::PlayerHasControllerMapped(const PlayerId pid) const
{
const auto mapping_matches_player_id = [pid](const PlayerId& mapping) { return mapping == pid; };
- return std::any_of(m_pad_map.begin(), m_pad_map.end(), mapping_matches_player_id) ||
- std::any_of(m_wiimote_map.begin(), m_wiimote_map.end(), mapping_matches_player_id);
+ return std::ranges::any_of(m_pad_map, mapping_matches_player_id) ||
+ std::ranges::any_of(m_wiimote_map, mapping_matches_player_id);
}
bool NetPlayClient::IsLocalPlayer(const PlayerId pid) const
diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp
index 0f53e8008f..77a52e814b 100644
--- a/Source/Core/Core/NetPlayServer.cpp
+++ b/Source/Core/Core/NetPlayServer.cpp
@@ -2232,8 +2232,8 @@ bool NetPlayServer::PlayerHasControllerMapped(const PlayerId pid) const
{
const auto mapping_matches_player_id = [pid](const PlayerId& mapping) { return mapping == pid; };
- return std::any_of(m_pad_map.begin(), m_pad_map.end(), mapping_matches_player_id) ||
- std::any_of(m_wiimote_map.begin(), m_wiimote_map.end(), mapping_matches_player_id);
+ return std::ranges::any_of(m_pad_map, mapping_matches_player_id) ||
+ std::ranges::any_of(m_wiimote_map, mapping_matches_player_id);
}
void NetPlayServer::AssignNewUserAPad(const Client& player)
diff --git a/Source/Core/Core/PowerPC/BreakPoints.cpp b/Source/Core/Core/PowerPC/BreakPoints.cpp
index 1fef4e4e25..19ceac7b3f 100644
--- a/Source/Core/Core/PowerPC/BreakPoints.cpp
+++ b/Source/Core/Core/PowerPC/BreakPoints.cpp
@@ -371,7 +371,7 @@ bool MemChecks::OverlapsMemcheck(u32 address, u32 length) const
const u32 page_end_suffix = length - 1;
const u32 page_end_address = address | page_end_suffix;
- return std::any_of(m_mem_checks.cbegin(), m_mem_checks.cend(), [&](const auto& mc) {
+ return std::ranges::any_of(m_mem_checks, [&](const auto& mc) {
return ((mc.start_address | page_end_suffix) == page_end_address ||
(mc.end_address | page_end_suffix) == page_end_address) ||
((mc.start_address | page_end_suffix) < page_end_address &&
diff --git a/Source/Core/Core/PowerPC/Expression.cpp b/Source/Core/Core/PowerPC/Expression.cpp
index a05fa2c8b2..7c12b3b16a 100644
--- a/Source/Core/Core/PowerPC/Expression.cpp
+++ b/Source/Core/Core/PowerPC/Expression.cpp
@@ -136,15 +136,14 @@ static double CallstackFunc(expr_func* f, vec_expr_t* args, void* c)
if (!std::isnan(num))
{
u32 address = static_cast<u32>(num);
- return std::any_of(stack.begin(), stack.end(),
- [address](const auto& s) { return s.vAddress == address; });
+ return std::ranges::any_of(stack, [address](const auto& s) { return s.vAddress == address; });
}
const char* cstr = expr_get_str(&vec_nth(args, 0));
if (cstr != nullptr)
{
- return std::any_of(stack.begin(), stack.end(),
- [cstr](const auto& s) { return s.Name.find(cstr) != std::string::npos; });
+ return std::ranges::any_of(
+ stack, [cstr](const auto& s) { return s.Name.find(cstr) != std::string::npos; });
}
return 0;
diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
index f06423ce3e..c1b8b63adf 100644
--- a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp
@@ -754,6 +754,5 @@ void RegCache::Realize(preg_t preg)
bool RegCache::IsAnyConstraintActive() const
{
- return std::any_of(m_constraints.begin(), m_constraints.end(),
- [](const auto& c) { return c.IsActive(); });
+ return std::ranges::any_of(m_constraints, &RCConstraint::IsActive);
}
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp b/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
index 39b173095c..033ca756cd 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
@@ -112,7 +112,7 @@ JitBase::~JitBase()
bool JitBase::DoesConfigNeedRefresh()
{
- return std::any_of(JIT_SETTINGS.begin(), JIT_SETTINGS.end(), [this](const auto& pair) {
+ return std::ranges::any_of(JIT_SETTINGS, [this](const auto& pair) {
return this->*pair.first != Config::Get(*pair.second);
});
}
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
index 003dcc7b3f..c8ab26f884 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
@@ -191,7 +191,7 @@ static void AnalyzeFunction2(PPCSymbolDB* func_db, Common::Symbol* func)
{
u32 flags = func->flags;
- bool nonleafcall = std::any_of(func->calls.begin(), func->calls.end(), [&](const auto& call) {
+ bool nonleafcall = std::ranges::any_of(func->calls, [&](const auto& call) {
const Common::Symbol* const called_func = func_db->GetSymbolFromAddr(call.function);
return called_func && (called_func->flags & Common::FFLAG_LEAF) == 0;
});
diff --git a/Source/Core/Core/WiiUtils.cpp b/Source/Core/Core/WiiUtils.cpp
index 2d5a8e4ac3..054f3cf0c1 100644
--- a/Source/Core/Core/WiiUtils.cpp
+++ b/Source/Core/Core/WiiUtils.cpp
@@ -223,15 +223,14 @@ bool IsTitleInstalled(u64 title_id)
// Since this isn't IOS and we only need a simple way to figure out if a title is installed,
// we make the (reasonable) assumption that having more than just the TMD in the content
// directory means that the title is installed.
- return std::any_of(entries->begin(), entries->end(),
- [](const std::string& file) { return file != "title.tmd"; });
+ return std::ranges::any_of(*entries, [](const std::string& file) { return file != "title.tmd"; });
}
bool IsTMDImported(IOS::HLE::FS::FileSystem& fs, u64 title_id)
{
const auto entries = fs.ReadDirectory(0, 0, Common::GetTitleContentPath(title_id));
- return entries && std::any_of(entries->begin(), entries->end(),
- [](const std::string& file) { return file == "title.tmd"; });
+ return entries &&
+ std::ranges::any_of(*entries, [](const std::string& file) { return file == "title.tmd"; });
}
IOS::ES::TMDReader FindBackupTMD(IOS::HLE::FS::FileSystem& fs, u64 title_id)
@@ -947,8 +946,8 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
}
const auto installed_contents = es.GetStoredContentsFromTMD(tmd);
- const bool is_installed = std::any_of(installed_contents.begin(), installed_contents.end(),
- [](const auto& content) { return !content.IsShared(); });
+ const bool is_installed = std::ranges::any_of(
+ installed_contents, [](const auto& content) { return !content.IsShared(); });
if (is_installed && installed_contents != tmd.GetContents() &&
(tmd.GetTitleFlags() & IOS::ES::TitleFlags::TITLE_TYPE_DATA) == 0)
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<std::string_view, 4> 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<std::string_view, 4> 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. "
diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
index cc38a9382b..42f6f28de9 100644
--- a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
+++ b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
@@ -598,9 +598,8 @@ void ShakeMappingIndicator::Update(float elapsed_seconds)
m_position_samples.push_front(ShakeSample{m_motion_state.position / MAX_DISTANCE});
- const bool any_non_zero_samples =
- std::any_of(m_position_samples.begin(), m_position_samples.end(),
- [](const ShakeSample& s) { return s.state.LengthSquared() != 0.0; });
+ const bool any_non_zero_samples = std::ranges::any_of(
+ m_position_samples, [](const ShakeSample& s) { return s.state.LengthSquared() != 0.0; });
// Only start moving the line if there's non-zero data.
if (m_grid_line_position || any_non_zero_samples)
diff --git a/Source/Core/DolphinQt/ConvertDialog.cpp b/Source/Core/DolphinQt/ConvertDialog.cpp
index e316eed9c1..e13463806b 100644
--- a/Source/Core/DolphinQt/ConvertDialog.cpp
+++ b/Source/Core/DolphinQt/ConvertDialog.cpp
@@ -309,7 +309,7 @@ void ConvertDialog::Convert()
}
if (!scrub && format == DiscIO::BlobType::GCZ &&
- std::any_of(m_files.begin(), m_files.end(), [](const auto& file) {
+ std::ranges::any_of(m_files, [](const auto& file) {
return file->GetPlatform() == DiscIO::Platform::WiiDisc && !file->IsDatelDisc();
}))
{
@@ -321,7 +321,7 @@ void ConvertDialog::Convert()
}
}
- if (std::any_of(m_files.begin(), m_files.end(), std::mem_fn(&UICommon::GameFile::IsNKit)))
+ if (std::ranges::any_of(m_files, &UICommon::GameFile::IsNKit))
{
if (!ShowAreYouSureDialog(
tr("Dolphin can't convert NKit files to non-NKit files. Converting an NKit file in "
diff --git a/Source/Core/DolphinQt/Settings/AudioPane.cpp b/Source/Core/DolphinQt/Settings/AudioPane.cpp
index 1cf98ba645..c61245375a 100644
--- a/Source/Core/DolphinQt/Settings/AudioPane.cpp
+++ b/Source/Core/DolphinQt/Settings/AudioPane.cpp
@@ -428,8 +428,7 @@ void AudioPane::OnVolumeChanged(int volume)
void AudioPane::CheckNeedForLatencyControl()
{
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
- m_latency_control_supported =
- std::any_of(backends.cbegin(), backends.cend(), AudioCommon::SupportsLatencyControl);
+ m_latency_control_supported = std::ranges::any_of(backends, AudioCommon::SupportsLatencyControl);
}
QString AudioPane::GetDPL2QualityLabel(AudioCommon::DPL2Quality value) const
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp
index 0ad720dcdb..787665b366 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUGyroscope.cpp
@@ -90,8 +90,8 @@ void IMUGyroscope::UpdateCalibration(const StateData& state)
// Check for required calibration update frequency
// and if current data is within deadzone distance of mean stable value.
if (calibration_freq < WORST_ACCEPTABLE_CALIBRATION_UPDATE_FREQUENCY ||
- std::any_of(current_difference.data.begin(), current_difference.data.end(),
- [&](auto c) { return std::abs(c) > deadzone; }))
+ std::ranges::any_of(current_difference.data,
+ [&](auto c) { return std::abs(c) > deadzone; }))
{
RestartCalibration();
}
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index 769e6c5f0e..10dd492ceb 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -248,7 +248,7 @@ bool ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device
std::lock_guard lk(m_devices_mutex);
const auto is_id_in_use = [&device, this](int id) {
- return std::any_of(m_devices.begin(), m_devices.end(), [&device, &id](const auto& d) {
+ return std::ranges::any_of(m_devices, [&device, &id](const auto& d) {
return d->GetSource() == device->GetSource() && d->GetName() == device->GetName() &&
d->GetId() == id;
});
@@ -368,10 +368,8 @@ void ControllerInterface::UpdateInput()
if (devices_to_remove.size() > 0)
{
RemoveDevice([&](const ciface::Core::Device* device) {
- return std::any_of(devices_to_remove.begin(), devices_to_remove.end(),
- [device](const std::weak_ptr<ciface::Core::Device>& d) {
- return d.lock().get() == device;
- });
+ return std::ranges::any_of(devices_to_remove,
+ [device](const auto& d) { return d.lock().get() == device; });
});
}
}
diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
index fb9d43f22f..40ef725b66 100644
--- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
@@ -137,8 +137,8 @@ BuildExpression(const std::vector<ciface::Core::DeviceContainer::InputDetection>
void RemoveSpuriousTriggerCombinations(
std::vector<ciface::Core::DeviceContainer::InputDetection>* detections)
{
- const auto is_spurious = [&](auto& detection) {
- return std::any_of(detections->begin(), detections->end(), [&](auto& d) {
+ const auto is_spurious = [&](const auto& detection) {
+ return std::ranges::any_of(*detections, [&](const auto& d) {
// This is a spurious digital detection if a "smooth" (analog) detection is temporally near.
return &d != &detection && d.smoothness > 1 && d.smoothness > detection.smoothness &&
abs(d.press_time - detection.press_time) < SPURIOUS_TRIGGER_COMBO_THRESHOLD;
diff --git a/Source/Core/VideoBackends/OGL/OGLGfx.cpp b/Source/Core/VideoBackends/OGL/OGLGfx.cpp
index fa20a76d11..6a97aa5982 100644
--- a/Source/Core/VideoBackends/OGL/OGLGfx.cpp
+++ b/Source/Core/VideoBackends/OGL/OGLGfx.cpp
@@ -304,8 +304,8 @@ void OGLGfx::DispatchComputeShader(const AbstractShader* shader, u32 groupsize_x
static_cast<const OGLPipeline*>(m_current_pipeline)->GetProgram()->shader.Bind();
// Barrier to texture can be used for reads.
- if (std::any_of(m_bound_image_textures.begin(), m_bound_image_textures.end(),
- [](auto image) { return image != nullptr; }))
+ if (std::ranges::any_of(m_bound_image_textures,
+ [](const auto* image) { return image != nullptr; }))
{
glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT);
}
diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
index ed2407775a..ed3b709529 100644
--- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
@@ -929,8 +929,8 @@ void VulkanContext::DisableDebugUtils()
bool VulkanContext::SupportsDeviceExtension(const char* name) const
{
- return std::any_of(m_device_extensions.begin(), m_device_extensions.end(),
- [name](const std::string& extension) { return extension == name; });
+ return std::ranges::any_of(m_device_extensions,
+ [name](const std::string& extension) { return extension == name; });
}
static bool DriverIsMesa(VkDriverId driver_id)
diff --git a/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp b/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
index 4446f602e8..887875d2cb 100644
--- a/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
+++ b/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
@@ -69,10 +69,8 @@ CustomAssetLibrary::LoadInfo CustomAssetLibrary::LoadGameTexture(const AssetID&
}
// All levels have to have the same format.
- if (std::any_of(slice.m_levels.begin(), slice.m_levels.end(),
- [&first_mip](const VideoCommon::CustomTextureData::ArraySlice::Level& l) {
- return l.format != first_mip.format;
- }))
+ if (std::ranges::any_of(slice.m_levels,
+ [&first_mip](const auto& l) { return l.format != first_mip.format; }))
{
ERROR_LOG_FMT(
VIDEO, "Custom game texture {} has inconsistent formats across mip levels for slice {}.",