aboutsummaryrefslogtreecommitdiffhomepage
path: root/tdutils/td/utils/WaitFreeHashMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'tdutils/td/utils/WaitFreeHashMap.h')
-rw-r--r--tdutils/td/utils/WaitFreeHashMap.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tdutils/td/utils/WaitFreeHashMap.h b/tdutils/td/utils/WaitFreeHashMap.h
index 592ac96d9..956a1a865 100644
--- a/tdutils/td/utils/WaitFreeHashMap.h
+++ b/tdutils/td/utils/WaitFreeHashMap.h
@@ -161,6 +161,21 @@ class WaitFreeHashMap {
}
}
+ template <class F>
+ bool remove_if(const F &f) {
+ if (wait_free_storage_ == nullptr) {
+ return default_map_.remove_if(f);
+ }
+
+ bool is_removed = false;
+ for (auto &it : wait_free_storage_->maps_) {
+ if (it.remove_if(f)) {
+ is_removed = true;
+ }
+ }
+ return is_removed;
+ }
+
size_t calc_size() const {
if (wait_free_storage_ == nullptr) {
return default_map_.size();