mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
AK: Remove HashMap::ensure_capacity
This is not perfect, since the constuctor can still fail.
This commit is contained in:
parent
0380ff30aa
commit
54c12b76ed
Notes:
sideshowbarker
2024-07-17 03:28:09 +09:00
Author: https://github.com/thomasqueirozb Commit: https://github.com/SerenityOS/serenity/commit/54c12b76ed Pull-request: https://github.com/SerenityOS/serenity/pull/16334
@ -34,7 +34,7 @@ public:
|
||||
|
||||
HashMap(std::initializer_list<Entry> list)
|
||||
{
|
||||
ensure_capacity(list.size());
|
||||
MUST(try_ensure_capacity(list.size()));
|
||||
for (auto& item : list)
|
||||
set(item.key, item.value);
|
||||
}
|
||||
@ -124,7 +124,6 @@ public:
|
||||
return m_table.find(Traits<Key>::hash(key), [&](auto& entry) { return Traits<K>::equals(key, entry.key); });
|
||||
}
|
||||
|
||||
void ensure_capacity(size_t capacity) { m_table.ensure_capacity(capacity); }
|
||||
ErrorOr<void> try_ensure_capacity(size_t capacity) { return m_table.try_ensure_capacity(capacity); }
|
||||
|
||||
Optional<typename Traits<V>::ConstPeekType> get(K const& key) const
|
||||
|
Loading…
Reference in New Issue
Block a user