From 969334505dbe7115e897a3102ecf234d7c3c4644 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 13 Oct 2018 14:23:47 +0200 Subject: [PATCH] Add HashMap::remove(). --- AK/HashMap.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AK/HashMap.h b/AK/HashMap.h index 7707fc9cabd..751f2dbb1ab 100644 --- a/AK/HashMap.h +++ b/AK/HashMap.h @@ -50,6 +50,7 @@ public: unsigned capacity() const { return m_table.capacity(); } void set(const K&, V&&); + void remove(const K&); typedef HashTable HashTableType; typedef typename HashTableType::Iterator IteratorType; @@ -75,6 +76,13 @@ void HashMap::set(const K& key, V&& value) m_table.set(Entry{key, std::move(value)}); } +template +void HashMap::remove(const K& key) +{ + Entry dummy { key, V() }; + m_table.remove(dummy); +} + template auto HashMap::find(const K& key) -> IteratorType {