From 5112f2a3a3db1e67bb9fe7a31428d123b2185702 Mon Sep 17 00:00:00 2001 From: cat Date: Mon, 2 Mar 2026 08:59:42 +0200 Subject: [PATCH] Bugfix: Hash position was calculated before rehash --- headers/Containers/Hashmap.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/headers/Containers/Hashmap.hpp b/headers/Containers/Hashmap.hpp index 01413f9..f7d0c3c 100644 --- a/headers/Containers/Hashmap.hpp +++ b/headers/Containers/Hashmap.hpp @@ -23,11 +23,11 @@ public: ~Hashmap() { Clear(); } Value &Insert(Key key, Value value) { - std::size_t keyHash = std::hash{}(key), - keyHashPosition = keyHash % storage.size(); if (currentLoadFactor >= loadFactor && currentlyRehashing == false) { rehash(); } + std::size_t keyHash = std::hash{}(key), + keyHashPosition = keyHash % storage.size(); // Empty bucket if (storage[keyHashPosition] == nullptr) {