From 01b7d96ebd7302910f3f15eff953bbd67b9b3273 Mon Sep 17 00:00:00 2001 From: IlushaShurupov Date: Fri, 11 Aug 2023 16:21:30 +0300 Subject: [PATCH] Fixin map --- Containers/public/Map.hpp | 9 +++++++-- Parser/rsc/grammar.txt | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Containers/public/Map.hpp b/Containers/public/Map.hpp index eb80279..2c398c4 100644 --- a/Containers/public/Map.hpp +++ b/Containers/public/Map.hpp @@ -41,7 +41,7 @@ namespace tp { private: tAllocator mAlloc; - Node** mTable; + Node** mTable = nullptr; ualni mNSlots = 0; ualni mNEntries = 0; @@ -181,6 +181,10 @@ namespace tp { mTable = newTable(mNSlots); } + Map(const Map& in) { + this->operator=(in); + } + Node** buff() const { return mTable; } @@ -202,8 +206,9 @@ namespace tp { if (!mTable[idx] || isDeletedNode(mTable[idx])) { mTable[idx] = newNode(key, val); mNEntries++; + } else { + mTable[idx]->val = val; } - mTable[idx]->val = val; if ((halnf) mNEntries / mNSlots > maxLoadFactor()) { rehash(); } diff --git a/Parser/rsc/grammar.txt b/Parser/rsc/grammar.txt index 93d36e3..554b086 100644 --- a/Parser/rsc/grammar.txt +++ b/Parser/rsc/grammar.txt @@ -8,5 +8,5 @@ This grammar wil produce text in the form: TODO Start A /* Production rule */ -A : [ ID ]; +A : [ ID ] [ IS ] [ IDs ];