mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
AK: Add ensure_capacity() for HashMap and HashTable.
These functions make sure that the underlying table can accomodate at least 'capacity' entries before needing a rehash.
This commit is contained in:
parent
4fb2e5d8af
commit
12120167a9
Notes:
sideshowbarker
2024-07-19 13:55:16 +09:00
Author: https://github.com/awesomekling
Commit: 12120167a9
2 changed files with 8 additions and 0 deletions
|
@ -49,6 +49,12 @@ public:
|
|||
int size() const { return m_size; }
|
||||
int capacity() const { return m_capacity; }
|
||||
|
||||
void ensure_capacity(int capacity)
|
||||
{
|
||||
ASSERT(capacity >= size());
|
||||
rehash(capacity);
|
||||
}
|
||||
|
||||
void set(const T&);
|
||||
void set(T&&);
|
||||
bool contains(const T&) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue