From 577fb30be06c8655358a1d4bc048002ba189a786 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sun, 3 Jan 2021 10:36:37 -0600 Subject: [PATCH] feat(array): add TSFixedArray::~TSFixedArray --- storm/array/TSFixedArray.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/storm/array/TSFixedArray.hpp b/storm/array/TSFixedArray.hpp index 0782322..46a73c5 100644 --- a/storm/array/TSFixedArray.hpp +++ b/storm/array/TSFixedArray.hpp @@ -8,10 +8,23 @@ template class TSFixedArray : public TSBaseArray { public: + ~TSFixedArray(); void ReallocData(uint32_t count); void SetCount(uint32_t count); }; +template +TSFixedArray::~TSFixedArray() { + for (int32_t i = 0; i < this->Count(); i++) { + auto element = &this->operator[](i); + element->~T(); + } + + if (this->Ptr()) { + SMemFree(this->Ptr(), this->MemFileName(), this->MemLineNo(), 0x0); + } +} + template void TSFixedArray::ReallocData(uint32_t count) { T* oldData = this->m_data;