mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:07:34 +00:00
Add HashMap::remove().
This commit is contained in:
parent
c2ef54c044
commit
969334505d
1 changed files with 8 additions and 0 deletions
|
@ -50,6 +50,7 @@ public:
|
||||||
unsigned capacity() const { return m_table.capacity(); }
|
unsigned capacity() const { return m_table.capacity(); }
|
||||||
|
|
||||||
void set(const K&, V&&);
|
void set(const K&, V&&);
|
||||||
|
void remove(const K&);
|
||||||
|
|
||||||
typedef HashTable<Entry, EntryTraits> HashTableType;
|
typedef HashTable<Entry, EntryTraits> HashTableType;
|
||||||
typedef typename HashTableType::Iterator IteratorType;
|
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)});
|
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>
|
template<typename K, typename V>
|
||||||
auto HashMap<K, V>::find(const K& key) -> IteratorType
|
auto HashMap<K, V>::find(const K& key) -> IteratorType
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue