| 1041 | |
| 1042 | template<typename T> |
| 1043 | void Vector<T>::reserve(size_t newCapacity, bool freeMemory) |
| 1044 | { |
| 1045 | newCapacity = D3D12MA_MAX(newCapacity, m_Count); |
| 1046 | |
| 1047 | if ((newCapacity < m_Capacity) && !freeMemory) |
| 1048 | { |
| 1049 | newCapacity = m_Capacity; |
| 1050 | } |
| 1051 | |
| 1052 | if (newCapacity != m_Capacity) |
| 1053 | { |
| 1054 | T* const newArray = newCapacity ? AllocateArray<T>(m_AllocationCallbacks, newCapacity) : NULL; |
| 1055 | if (m_Count != 0) |
| 1056 | { |
| 1057 | memcpy(newArray, m_pArray, m_Count * sizeof(T)); |
| 1058 | } |
| 1059 | Free(m_AllocationCallbacks, m_pArray); |
| 1060 | m_Capacity = newCapacity; |
| 1061 | m_pArray = newArray; |
| 1062 | } |
| 1063 | } |
| 1064 | |
| 1065 | template<typename T> |
| 1066 | void Vector<T>::resize(size_t newCount, bool freeMemory) |
no test coverage detected