From b7b40be20348ceca5308a1878044992c2e0a54f7 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 18 Jan 2022 01:34:05 +0000 Subject: Collection::removeAll returns how many matched by type --- lib/collection.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/collection.hpp') 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 - void + auto removeAll() { - objects.erase(std::remove_if(objects.begin(), objects.end(), - [](auto && op) { - return dynamic_cast(op.get()); - }), - objects.end()); + return std::erase_if(objects, [](auto && op) { + return dynamic_cast(op.get()); + }); } auto -- cgit v1.2.3