12 template <
typename T, u
int64_t ArraySize>
15 assert(index < m_end_index);
17 return m_vector[index];
19 return m_array[index];
23 template <
typename T, u
int64_t ArraySize>
26 assert(index < m_end_index);
28 return m_vector[index];
30 return m_array[index];
34 template <
typename T, u
int64_t ArraySize>
38 m_vector.emplace_back(val);
43 if (m_end_index < ArraySize) {
44 m_array[m_end_index++] = val;
51 m_vector.emplace_back(val);
55 template <
typename T, u
int64_t ArraySize>
61 template <
typename T, u
int64_t ArraySize>
65 return m_vector.capacity();
70 template <
typename T, u
int64_t ArraySize>
76 template <
typename T, u
int64_t ArraySize>
79 if (new_capacity < ArraySize) {
87 m_vector.reserve(new_capacity);
90 template <
typename T, u
int64_t ArraySize>
96 template <
typename T, u
int64_t ArraySize>
99 logger().debug(
"Switching from array to vector.");
101 m_vector.reserve(ArraySize * 2);
102 std::copy(m_array.begin(), m_array.end(), std::back_inserter(m_vector));
105 template <
typename T, u
int64_t ArraySize>
107 : m_container(container)
111 template <
typename T, u
int64_t ArraySize>
118 template <
typename T, u
int64_t ArraySize>
121 return m_index != other.
m_index;
124 template <
typename T, u
int64_t ArraySize>
127 return (*m_container)[m_index];
bool operator!=(const Iterator &other) const
Iterator(const DynamicArray *container, const uint64_t index=0)
void reserve(const uint64_t new_capacity)
void emplace_back(const T &val)
T & operator[](const uint64_t index)
constexpr static uint64_t array_size()
Return the size of the static array.
uint64_t capacity() const
spdlog::logger & logger()
Retrieves the current logger.