Fixin map
This commit is contained in:
parent
6fcfa075f8
commit
01b7d96ebd
2 changed files with 8 additions and 3 deletions
|
|
@ -41,7 +41,7 @@ namespace tp {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
tAllocator mAlloc;
|
tAllocator mAlloc;
|
||||||
Node** mTable;
|
Node** mTable = nullptr;
|
||||||
ualni mNSlots = 0;
|
ualni mNSlots = 0;
|
||||||
ualni mNEntries = 0;
|
ualni mNEntries = 0;
|
||||||
|
|
||||||
|
|
@ -181,6 +181,10 @@ namespace tp {
|
||||||
mTable = newTable(mNSlots);
|
mTable = newTable(mNSlots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map(const Map& in) {
|
||||||
|
this->operator=(in);
|
||||||
|
}
|
||||||
|
|
||||||
Node** buff() const {
|
Node** buff() const {
|
||||||
return mTable;
|
return mTable;
|
||||||
}
|
}
|
||||||
|
|
@ -202,8 +206,9 @@ namespace tp {
|
||||||
if (!mTable[idx] || isDeletedNode(mTable[idx])) {
|
if (!mTable[idx] || isDeletedNode(mTable[idx])) {
|
||||||
mTable[idx] = newNode(key, val);
|
mTable[idx] = newNode(key, val);
|
||||||
mNEntries++;
|
mNEntries++;
|
||||||
}
|
} else {
|
||||||
mTable[idx]->val = val;
|
mTable[idx]->val = val;
|
||||||
|
}
|
||||||
if ((halnf) mNEntries / mNSlots > maxLoadFactor()) {
|
if ((halnf) mNEntries / mNSlots > maxLoadFactor()) {
|
||||||
rehash();
|
rehash();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,5 @@ This grammar wil produce text in the form: TODO
|
||||||
Start A
|
Start A
|
||||||
|
|
||||||
/* Production rule */
|
/* Production rule */
|
||||||
A : [ ID ];
|
A : [ ID ] [ IS ] [ IDs ];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue