Fixin map

This commit is contained in:
IlushaShurupov 2023-08-11 16:21:30 +03:00
parent 6fcfa075f8
commit 01b7d96ebd
2 changed files with 8 additions and 3 deletions

View file

@ -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();
}

View file

@ -8,5 +8,5 @@ This grammar wil produce text in the form: TODO
Start A
/* Production rule */
A : [ ID ];
A : [ ID ] [ IS ] [ IDs ];