fix(array): fix various bugs with array clearing

This commit is contained in:
fallenoak 2023-02-21 22:10:14 -06:00
parent 181ef114e4
commit 7e89d65d7a
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
3 changed files with 73 additions and 10 deletions

View file

@ -8,14 +8,21 @@
template <class T>
class TSFixedArray : public TSBaseArray<T> {
public:
TSFixedArray();
~TSFixedArray();
TSFixedArray<T>& operator=(const TSFixedArray<T>& source);
void Clear();
void ReallocAndClearData(uint32_t count);
void ReallocData(uint32_t count);
void Set(uint32_t count, const T* data);
void SetCount(uint32_t count);
};
template <class T>
TSFixedArray<T>::TSFixedArray() {
this->Constructor();
}
template <class T>
TSFixedArray<T>::~TSFixedArray() {
for (uint32_t i = 0; i < this->Count(); i++) {
@ -37,6 +44,12 @@ TSFixedArray<T>& TSFixedArray<T>::operator=(const TSFixedArray<T>& source) {
return *this;
}
template <class T>
void TSFixedArray<T>::Clear() {
this->~TSFixedArray<T>();
this->Constructor();
}
template <class T>
void TSFixedArray<T>::ReallocAndClearData(uint32_t count) {
this->m_alloc = count;