30 #include "dCoreStdafx.h"
44 const dInt32 GetCount()
const;
45 void SetCount(dInt32 count);
48 void Resize(dInt32 count);
49 dInt32 GetCapacity()
const;
51 T& operator[] (dInt32 i);
52 const T& operator[] (dInt32 i)
const;
55 void PushBack(
const T& element);
90 Resize(source.m_capacity);
91 SetCount(source.m_size);
92 for (dInt32 i = 0; i < source.m_size; i++)
94 m_array[i] = source[i];
127 dAssert(m_size <= m_capacity);
128 if (m_size == m_capacity)
130 Resize(m_capacity * 2);
132 dInt32 index = m_size;
134 (*this)[index] = element;
147 while (m_size > m_capacity)
149 Resize(m_capacity * 2);
168 if (size >= m_capacity)
170 size = dMax(size, 16);
174 for (dInt32 i = 0; i < m_capacity; i++)
176 memcpy(&newArray[i], &m_array[i],
sizeof(T));
183 else if (size < m_capacity)
185 size = dMax(size, 16);
189 for (dInt32 i = 0; i < size; i++)
191 memcpy(&newArray[i], &m_array[i],
sizeof(T));
203 dSwap(m_array, other.m_array);
204 dSwap(m_size, other.m_size);
205 dSwap(m_capacity, other.m_capacity);