1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

AK: Allow specifying HashSetExistingEntryBehavior in HashMap::set()

This commit is contained in:
Andreas Kling 2025-05-03 11:34:54 +02:00 committed by Andreas Kling
parent 8a80ff7b3b
commit a453da2906
Notes: github-actions[bot] 2025-05-03 15:35:05 +00:00

View file

@ -57,12 +57,12 @@ public:
void clear() { m_table.clear(); } void clear() { m_table.clear(); }
void clear_with_capacity() { m_table.clear_with_capacity(); } void clear_with_capacity() { m_table.clear_with_capacity(); }
HashSetResult set(K const& key, V const& value) { return m_table.set({ key, value }); } HashSetResult set(K const& key, V const& value, HashSetExistingEntryBehavior existing_entry_behavior = HashSetExistingEntryBehavior::Replace) { return m_table.set({ key, value }, existing_entry_behavior); }
HashSetResult set(K const& key, V&& value) { return m_table.set({ key, move(value) }); } HashSetResult set(K const& key, V&& value, HashSetExistingEntryBehavior existing_entry_behavior = HashSetExistingEntryBehavior::Replace) { return m_table.set({ key, move(value) }, existing_entry_behavior); }
HashSetResult set(K&& key, V&& value) { return m_table.set({ move(key), move(value) }); } HashSetResult set(K&& key, V&& value, HashSetExistingEntryBehavior existing_entry_behavior = HashSetExistingEntryBehavior::Replace) { return m_table.set({ move(key), move(value) }, existing_entry_behavior); }
ErrorOr<HashSetResult> try_set(K const& key, V const& value) { return m_table.try_set({ key, value }); } ErrorOr<HashSetResult> try_set(K const& key, V const& value, HashSetExistingEntryBehavior existing_entry_behavior = HashSetExistingEntryBehavior::Replace) { return m_table.try_set({ key, value }, existing_entry_behavior); }
ErrorOr<HashSetResult> try_set(K const& key, V&& value) { return m_table.try_set({ key, move(value) }); } ErrorOr<HashSetResult> try_set(K const& key, V&& value, HashSetExistingEntryBehavior existing_entry_behavior = HashSetExistingEntryBehavior::Replace) { return m_table.try_set({ key, move(value) }, existing_entry_behavior); }
ErrorOr<HashSetResult> try_set(K&& key, V&& value) { return m_table.try_set({ move(key), move(value) }); } ErrorOr<HashSetResult> try_set(K&& key, V&& value, HashSetExistingEntryBehavior existing_entry_behavior = HashSetExistingEntryBehavior::Replace) { return m_table.try_set({ move(key), move(value) }, existing_entry_behavior); }
bool remove(K const& key) bool remove(K const& key)
{ {