27 lines
617 B
C++
27 lines
617 B
C++
#ifndef STATICSEQLIST_H
|
|
#define STATICSEQLIST_H
|
|
|
|
#include "ArrayList.h"
|
|
|
|
namespace Kylin {
|
|
|
|
template <typename T, size_t N>
|
|
class StaticArrayList : public ArrayList<T> {
|
|
public:
|
|
StaticArrayList() { this->m_array = m_space; }
|
|
StaticArrayList(const StaticArrayList &other) {
|
|
this->m_array = m_space;
|
|
for (size_t i = 0; i < other.m_size; i++) {
|
|
m_space[i] = other.m_space[i];
|
|
this->m_size++;
|
|
}
|
|
}
|
|
virtual size_t capacity() const noexcept { return N; }
|
|
|
|
private:
|
|
T m_space[N];
|
|
};
|
|
} // namespace Kylin
|
|
|
|
#endif // STATICSEQLIST_H
|