Add HashMap::remove().

This commit is contained in:
Andreas Kling 2018-10-13 14:23:47 +02:00
parent c2ef54c044
commit 969334505d
Notes: sideshowbarker 2024-07-19 18:49:14 +09:00

View file

@ -50,6 +50,7 @@ public:
unsigned capacity() const { return m_table.capacity(); }
void set(const K&, V&&);
void remove(const K&);
typedef HashTable<Entry, EntryTraits> HashTableType;
typedef typename HashTableType::Iterator IteratorType;
@ -75,6 +76,13 @@ void HashMap<K, V>::set(const K& key, V&& value)
m_table.set(Entry{key, std::move(value)});
}
template<typename K, typename V>
void HashMap<K, V>::remove(const K& key)
{
Entry dummy { key, V() };
m_table.remove(dummy);
}
template<typename K, typename V>
auto HashMap<K, V>::find(const K& key) -> IteratorType
{