summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-18 01:34:05 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-18 01:34:05 +0000
commitb7b40be20348ceca5308a1878044992c2e0a54f7 (patch)
treee5ca7b93811ba9fcc25c99e078fa81300c7d1159
parentWe know the last param is distance now (diff)
downloadilt-b7b40be20348ceca5308a1878044992c2e0a54f7.tar.bz2
ilt-b7b40be20348ceca5308a1878044992c2e0a54f7.tar.xz
ilt-b7b40be20348ceca5308a1878044992c2e0a54f7.zip
Collection::removeAll returns how many matched by type
-rw-r--r--lib/collection.hpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/collection.hpp b/lib/collection.hpp
index 8b39ae4..6e05824 100644
--- a/lib/collection.hpp
+++ b/lib/collection.hpp
@@ -55,14 +55,12 @@ public:
}
template<typename T = Object>
- void
+ auto
removeAll()
{
- objects.erase(std::remove_if(objects.begin(), objects.end(),
- [](auto && op) {
- return dynamic_cast<T *>(op.get());
- }),
- objects.end());
+ return std::erase_if(objects, [](auto && op) {
+ return dynamic_cast<T *>(op.get());
+ });
}
auto