38 DG_CLASS_ALLOCATOR(allocator)
40 T &operator[](dgInt32 i);
41 const T &operator[](dgInt32 i)
const;
42 void Resize(dgInt32 size)
const;
45 dgInt32 m_granulatity;
46 mutable dgInt32 m_maxSize;
55 m_granulatity = granulatitySize;
57 m_allocator = allocator;
63 m_allocator->FreeLow(m_array);
70 NEWTON_ASSERT(i >= 0);
71 while (i >= m_maxSize) {
80 NEWTON_ASSERT(i >= 0);
81 while (i >= m_maxSize) {
89 if (size >= m_maxSize) {
90 size = size + m_granulatity - (size + m_granulatity) % m_granulatity;
91 T *
const newArray = (T *) m_allocator->MallocLow(dgInt32(
sizeof(T) * size));
93 for (dgInt32 i = 0; i < m_maxSize; i ++) {
94 newArray[i] = m_array[i];
96 m_allocator->FreeLow(m_array);
100 }
else if (size < m_maxSize) {
101 size = size + m_granulatity - (size + m_granulatity) % m_granulatity;
102 T *
const newArray = (T *) m_allocator->MallocLow(dgInt32(
sizeof(T) * size));
104 for (dgInt32 i = 0; i < size; i ++) {
105 newArray[i] = m_array[i];
107 m_allocator->FreeLow(m_array);
Definition: dgMemory.h:80