mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +00:00
AK: Enable fast path for removal by hash-compatible key in HashMap/Table
This commit is contained in:
parent
b429f9c7aa
commit
c673b7220a
2 changed files with 22 additions and 0 deletions
|
@ -373,6 +373,17 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
template<Concepts::HashCompatible<T> K>
|
||||
requires(IsSame<TraitsForT, Traits<T>>) bool remove(K const& value)
|
||||
{
|
||||
auto it = find(value);
|
||||
if (it != end()) {
|
||||
remove(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void remove(Iterator iterator)
|
||||
{
|
||||
VERIFY(iterator.m_bucket);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue