feat(array): add base array template

This commit is contained in:
fallenoak 2020-09-24 23:33:18 -05:00
parent 942fb18537
commit 5946abcb7d
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
3 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,34 @@
#ifndef STORM_ARRAY_TS_BASE_ARRAY_HPP
#define STORM_ARRAY_TS_BASE_ARRAY_HPP
#include <cstdint>
template<class T>
class TSBaseArray {
public:
uint32_t m_alloc = 0;
uint32_t m_count = 0;
T* m_data = nullptr;
T& operator[](uint32_t i);
uint32_t Count(void);
void Clear(void);
};
template<class T>
T& TSBaseArray<T>::operator[](uint32_t i) {
return this->m_data[i];
}
template<class T>
uint32_t TSBaseArray<T>::Count() {
return this->m_count;
}
template<class T>
void TSBaseArray<T>::Clear() {
delete[] this->m_data;
TSBaseArray<T>();
}
#endif