1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:27:43 +00:00

Add HashTable::remove() and fix a bug where ConstIterator would skip the first.

This commit is contained in:
Andreas Kling 2018-10-13 14:22:09 +02:00
parent f794190de0
commit c2ef54c044
2 changed files with 48 additions and 3 deletions

View file

@ -155,5 +155,33 @@ int main(int, char**)
printInts(v);
}
{
auto printInts = [] (const HashTable<int>& h) {
printf("HashTable {\n size: %u\n capacity: %u\n elements: ", h.size(), h.capacity());
for (auto i : h)
printf("%d ", i);
printf("\n}\n");
};
HashTable<int> h;
h.set(10);
h.set(20);
h.set(30);
h.set(40);
h.set(50);
h.dump();
printInts(h);
h.remove(30);
printInts(h);
h.set(30);
h.remove(30);
printInts(h);
}
return 0;
}