mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
fix(array): fix various bugs with array clearing
This commit is contained in:
parent
181ef114e4
commit
7e89d65d7a
3 changed files with 73 additions and 10 deletions
|
|
@ -8,17 +8,20 @@
|
|||
template <class T>
|
||||
class TSBaseArray {
|
||||
public:
|
||||
uint32_t m_alloc = 0;
|
||||
uint32_t m_count = 0;
|
||||
T* m_data = nullptr;
|
||||
// Member variables
|
||||
uint32_t m_alloc;
|
||||
uint32_t m_count;
|
||||
T* m_data;
|
||||
|
||||
// Virtual member functions
|
||||
virtual const char* MemFileName() const;
|
||||
virtual int32_t MemLineNo() const;
|
||||
|
||||
// Member functions
|
||||
T& operator[](uint32_t index);
|
||||
void CheckArrayBounds(uint32_t index) const;
|
||||
void Constructor();
|
||||
uint32_t Count() const;
|
||||
void Clear();
|
||||
T* Ptr();
|
||||
const T* Ptr() const;
|
||||
T* Top();
|
||||
|
|
@ -48,14 +51,15 @@ void TSBaseArray<T>::CheckArrayBounds(uint32_t index) const {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
uint32_t TSBaseArray<T>::Count() const {
|
||||
return this->m_count;
|
||||
void TSBaseArray<T>::Constructor() {
|
||||
this->m_alloc = 0;
|
||||
this->m_count = 0;
|
||||
this->m_data = nullptr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void TSBaseArray<T>::Clear() {
|
||||
delete[] this->m_data;
|
||||
TSBaseArray<T>();
|
||||
uint32_t TSBaseArray<T>::Count() const {
|
||||
return this->m_count;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue