util/IntrusiveHashSet: implement remove_and_dispose_if() with constant_time_size
This commit is contained in:
parent
7475e971bc
commit
52af03a5a6
|
@ -202,19 +202,15 @@ public:
|
||||||
|
|
||||||
void remove_and_dispose_if(Predicate<const_reference> auto pred,
|
void remove_and_dispose_if(Predicate<const_reference> auto pred,
|
||||||
Disposer<value_type> auto disposer) noexcept {
|
Disposer<value_type> auto disposer) noexcept {
|
||||||
static_assert(!constant_time_size, "Not yet implemented");
|
|
||||||
|
|
||||||
for (auto &bucket : table)
|
for (auto &bucket : table)
|
||||||
bucket.remove_and_dispose_if(pred, disposer);
|
counter -= bucket.remove_and_dispose_if(pred, disposer);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr void remove_and_dispose_if(const auto &key,
|
constexpr void remove_and_dispose_if(const auto &key,
|
||||||
Predicate<const_reference> auto pred,
|
Predicate<const_reference> auto pred,
|
||||||
Disposer<value_type> auto disposer) noexcept {
|
Disposer<value_type> auto disposer) noexcept {
|
||||||
static_assert(!constant_time_size, "Not yet implemented");
|
|
||||||
|
|
||||||
auto &bucket = GetBucket(key);
|
auto &bucket = GetBucket(key);
|
||||||
bucket.remove_and_dispose_if([this, &key, &pred](const auto &item){
|
counter -= bucket.remove_and_dispose_if([this, &key, &pred](const auto &item){
|
||||||
return equal(key, item) && pred(item);
|
return equal(key, item) && pred(item);
|
||||||
}, disposer);
|
}, disposer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue