mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
AK: Make HashTable and HashMap try_* functions return ErrorOr<T>
This allows us to use TRY() and MUST() with them.
This commit is contained in:
parent
4eaa95769d
commit
9d1f238450
3 changed files with 22 additions and 37 deletions
|
@ -49,8 +49,8 @@ public:
|
|||
|
||||
HashSetResult set(const K& key, const V& value) { return m_table.set({ key, value }); }
|
||||
HashSetResult set(const K& key, V&& value) { return m_table.set({ key, move(value) }); }
|
||||
HashSetResult try_set(const K& key, const V& value) { return m_table.try_set({ key, value }); }
|
||||
HashSetResult try_set(const K& key, V&& value) { return m_table.try_set({ key, move(value) }); }
|
||||
ErrorOr<HashSetResult> try_set(const K& key, const V& value) { return m_table.try_set({ key, value }); }
|
||||
ErrorOr<HashSetResult> try_set(const K& key, V&& value) { return m_table.try_set({ key, move(value) }); }
|
||||
|
||||
bool remove(const K& key)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
}
|
||||
|
||||
void ensure_capacity(size_t capacity) { m_table.ensure_capacity(capacity); }
|
||||
bool try_ensure_capacity(size_t capacity) { return m_table.try_ensure_capacity(capacity); }
|
||||
ErrorOr<void> try_ensure_capacity(size_t capacity) { return m_table.try_ensure_capacity(capacity); }
|
||||
|
||||
Optional<typename Traits<V>::PeekType> get(const K& key) const requires(!IsPointer<typename Traits<V>::PeekType>)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue