summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2024-07-21 19:06:55 +0100
committerGitHub <noreply@github.com>2024-07-21 19:06:55 +0100
commit7bd2a7bde301c9dc255ae45e60fcfcd8ba10aecc (patch)
tree3494efb586ed037db2c63b13d7f482f4599bfedc /Source/Core/InputCommon/ControllerInterface
parent652245006dc947c63b118174d216b24779aa1f21 (diff)
parent982893b04cb3605f7703ebf2b9a99d33efa3b3eb (diff)
Merge pull request #12945 from Tilka/erase_if
Use C++20 erase_if() instead of erase(remove_if()) (NFC)
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index ab266292bc..769e6c5f0e 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -308,7 +308,7 @@ void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::De
bool any_removed;
{
std::lock_guard lk(m_devices_mutex);
- auto it = std::remove_if(m_devices.begin(), m_devices.end(), [&callback](const auto& dev) {
+ const size_t erased = std::erase_if(m_devices, [&callback](const auto& dev) {
if (callback(dev.get()))
{
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "Removed device: {}", dev->GetQualifiedName());
@@ -316,9 +316,7 @@ void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::De
}
return false;
});
- const size_t prev_size = m_devices.size();
- m_devices.erase(it, m_devices.end());
- any_removed = m_devices.size() != prev_size;
+ any_removed = erased != 0;
}
if (any_removed && (!m_populating_devices_counter || force_devices_release))