allocPool: Add destructor which cleans up.

This commit is contained in:
Timothée Leclaire-Fournier 2024-03-01 17:19:40 -05:00
parent 6cd26d5ee9
commit 9f68be78db
2 changed files with 5 additions and 1 deletions

View File

@ -24,6 +24,11 @@ public:
initArray(defaultAllocNumbers);
}
~allocPool() {
for (auto i: vec)
delete i;
}
T *getPtr() {
if (pivot == 0)
resizeVec();

View File

@ -34,6 +34,5 @@ int main() {
std::cout << "Time (milliseconds) required for real allocations when constructing pool: " <<
std::chrono::duration_cast<std::chrono::milliseconds>(endAlloc - startAlloc).count() << "\n";
return 0;
}