mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 18:15:58 +00: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
|
@ -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 a new issue