util/IntrusiveHashSet: add method remove_and_dispose()

This commit is contained in:
Max Kellermann 2023-03-22 15:13:30 +01:00 committed by Max Kellermann
parent 90c3fe22f5
commit 99885c4cbc

View File

@ -188,6 +188,17 @@ public:
counter -= bucket.remove_and_dispose_if(pred, disposer);
}
/**
* Remove and dispose all items with the specified key.
*/
constexpr void remove_and_dispose(const auto &key,
Disposer<value_type> auto disposer) noexcept {
auto &bucket = GetBucket(key);
counter -= bucket.remove_and_dispose_if([this, &key](const auto &item){
return equal(key, item);
}, disposer);
}
constexpr void remove_and_dispose_if(const auto &key,
Predicate<const_reference> auto pred,
Disposer<value_type> auto disposer) noexcept {