Kylin/DataStructure/StaticArray.h
2023-12-27 10:29:16 +08:00

25 lines
542 B
C++

#ifndef STATICARRAY_H
#define STATICARRAY_H
#include "Array.h"
namespace Kylin {
template <typename T, size_t N>
class StaticArray : public Array<T> {
public:
StaticArray() { this->m_array = m_space; }
StaticArray(const StaticArray &other) {
this->m_array = m_space;
for (size_t i = 0; i < N; i++) {
m_space[i] = other.m_space[i];
}
}
size_t size() const noexcept override { return N; }
private:
T m_space[N];
};
} // namespace Kylin
#endif // STATICARRAY_H