summaryrefslogtreecommitdiff
path: root/AK/HashTable.h
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-05-28 11:53:16 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-28 17:31:20 +0200
commit0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425 (patch)
tree93dbbbeb714f258bd7fb044633eb83bdcd908286 /AK/HashTable.h
parentc11351ac507f863699d78aec46a77bd4d59e743c (diff)
downloadserenity-0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425.zip
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
Diffstat (limited to 'AK/HashTable.h')
-rw-r--r--AK/HashTable.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/AK/HashTable.h b/AK/HashTable.h
index 8a4b5f847d..7720a38f86 100644
--- a/AK/HashTable.h
+++ b/AK/HashTable.h
@@ -2,15 +2,16 @@
#include "Assertions.h"
#include "DoublyLinkedList.h"
-#include "Traits.h"
#include "StdLibExtras.h"
+#include "Traits.h"
#include "kstdio.h"
//#define HASHTABLE_DEBUG
namespace AK {
-template<typename T, typename = Traits<T>> class HashTable;
+template<typename T, typename = Traits<T>>
+class HashTable;
template<typename T, typename TraitsForT>
class HashTable {
@@ -20,7 +21,7 @@ private:
};
public:
- HashTable() { }
+ HashTable() {}
explicit HashTable(HashTable&& other)
: m_buckets(other.m_buckets)
, m_size(other.m_size)
@@ -112,6 +113,7 @@ public:
return;
}
}
+
private:
friend class HashTable;
explicit Iterator(HashTable& table, bool is_end, typename DoublyLinkedList<T>::Iterator bucket_iterator = DoublyLinkedList<T>::Iterator::universal_end(), int bucket_index = 0)
@@ -190,6 +192,7 @@ public:
return;
}
}
+
private:
friend class HashTable;
ConstIterator(const HashTable& table, bool is_end, typename DoublyLinkedList<T>::ConstIterator bucket_iterator = DoublyLinkedList<T>::ConstIterator::universal_end(), int bucket_index = 0)
@@ -285,7 +288,6 @@ void HashTable<T, TraitsForT>::set(const T& value)
m_size++;
}
-
template<typename T, typename TraitsForT>
void HashTable<T, TraitsForT>::rehash(int new_capacity)
{
@@ -308,14 +310,14 @@ void HashTable<T, TraitsForT>::rehash(int new_capacity)
}
}
- delete [] old_buckets;
+ delete[] old_buckets;
}
template<typename T, typename TraitsForT>
void HashTable<T, TraitsForT>::clear()
{
if (m_buckets) {
- delete [] m_buckets;
+ delete[] m_buckets;
m_buckets = nullptr;
}
m_capacity = 0;
@@ -429,4 +431,3 @@ void HashTable<T, TraitsForT>::dump() const
}
using AK::HashTable;
-