mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
Add HashMap::remove().
This commit is contained in:
parent
c2ef54c044
commit
969334505d
Notes:
sideshowbarker
2024-07-19 18:49:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/969334505db
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue