summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDano Perniš <danopernis@gmail.com>2020-10-17 14:44:59 +0200
committerAndreas Kling <kling@serenityos.org>2020-10-18 14:44:23 +0200
commit7f3f63dd923cdd616196a3b6504ec6b170257467 (patch)
tree4deb2089ab7bb86d2ef7b9e4e0e3e37a9f6690d8
parentaf20b9424f51098f9b246b4d10aa20153c821d1f (diff)
downloadserenity-7f3f63dd923cdd616196a3b6504ec6b170257467.zip
AK: Provide swap() for HashTable
-rw-r--r--AK/HashTable.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/AK/HashTable.h b/AK/HashTable.h
index cd53fb202b..63b37b04cc 100644
--- a/AK/HashTable.h
+++ b/AK/HashTable.h
@@ -133,6 +133,14 @@ public:
return *this;
}
+ friend void swap(HashTable& a, HashTable& b) noexcept
+ {
+ swap(a.m_buckets, b.m_buckets);
+ swap(a.m_size, b.m_size);
+ swap(a.m_capacity, b.m_capacity);
+ swap(a.m_deleted_count, b.m_deleted_count);
+ }
+
bool is_empty() const { return !m_size; }
size_t size() const { return m_size; }
size_t capacity() const { return m_capacity; }