diff options
| author | Tillmann Karras <tilkax@gmail.com> | 2024-07-21 16:26:35 +0100 |
|---|---|---|
| committer | Tillmann Karras <tilkax@gmail.com> | 2024-07-21 16:36:06 +0100 |
| commit | 982893b04cb3605f7703ebf2b9a99d33efa3b3eb (patch) | |
| tree | 2609f6116d1cda3d58724f2b751f9e87838683cf /Source/Core/InputCommon/ControllerInterface | |
| parent | 1fcb2ee5c12eb9a3552fcb6ea7dd2fcd7c6c1749 (diff) | |
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.cpp | 6 |
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)) |
