From 3239fce5c1ae8c839c27b4d9f1bb821e31637fcc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Nov 2022 10:46:11 +0100 Subject: [PATCH] util/IntrusiveHashSet: add remove_and_dispose_if() --- src/util/IntrusiveHashSet.hxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/IntrusiveHashSet.hxx b/src/util/IntrusiveHashSet.hxx index b5005ef4d..7d75031fb 100644 --- a/src/util/IntrusiveHashSet.hxx +++ b/src/util/IntrusiveHashSet.hxx @@ -194,6 +194,13 @@ public: counter.reset(); } + void remove_and_dispose_if(auto &&pred, auto &&disposer) noexcept { + static_assert(!constant_time_size, "Not yet implemented"); + + for (auto &bucket : table) + bucket.remove_and_dispose_if(pred, disposer); + } + [[nodiscard]] static constexpr slot_iterator iterator_to(reference item) noexcept { return Slot::iterator_to(item);