Bugfix: Hash position was calculated before rehash
This commit is contained in:
@@ -23,11 +23,11 @@ public:
|
|||||||
~Hashmap() { Clear(); }
|
~Hashmap() { Clear(); }
|
||||||
|
|
||||||
Value &Insert(Key key, Value value) {
|
Value &Insert(Key key, Value value) {
|
||||||
std::size_t keyHash = std::hash<Key>{}(key),
|
|
||||||
keyHashPosition = keyHash % storage.size();
|
|
||||||
if (currentLoadFactor >= loadFactor && currentlyRehashing == false) {
|
if (currentLoadFactor >= loadFactor && currentlyRehashing == false) {
|
||||||
rehash();
|
rehash();
|
||||||
}
|
}
|
||||||
|
std::size_t keyHash = std::hash<Key>{}(key),
|
||||||
|
keyHashPosition = keyHash % storage.size();
|
||||||
|
|
||||||
// Empty bucket
|
// Empty bucket
|
||||||
if (storage[keyHashPosition] == nullptr) {
|
if (storage[keyHashPosition] == nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user