summaryrefslogtreecommitdiff
path: root/AK/HashMap.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-10 23:00:21 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-11 01:27:46 +0100
commit9d1f2384505f08bb5b041990627eb50f2a6b941c (patch)
treec4eb2dac6b9ada5e3a5aa1a96fb4ca76f2ca9ea4 /AK/HashMap.h
parent4eaa95769d40e1838ea5a0577d41f005540fe92e (diff)
downloadserenity-9d1f2384505f08bb5b041990627eb50f2a6b941c.zip
AK: Make HashTable and HashMap try_* functions return ErrorOr<T>
This allows us to use TRY() and MUST() with them.
Diffstat (limited to 'AK/HashMap.h')
-rw-r--r--AK/HashMap.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/AK/HashMap.h b/AK/HashMap.h
index 9c9b9d972a..733a7057cc 100644
--- a/AK/HashMap.h
+++ b/AK/HashMap.h
@@ -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>)
{