| 124 | // Note: Moving this function into the header may cause performance regression. |
| 125 | template<class Size_T> |
| 126 | void SmallVectorBase<Size_T>::growTrivial(void* firstEl, std::size_t minSize, std::size_t typeSize) { |
| 127 | std::size_t newCapacity = getNewCapacity<Size_T>(minSize, typeSize, this->capacity()); |
| 128 | void* newElts; |
| 129 | if (BeginX == firstEl) { |
| 130 | newElts = std::malloc(newCapacity * typeSize); |
| 131 | if (newElts == firstEl) { |
| 132 | newElts = replaceAllocation(newElts, typeSize, newCapacity); |
| 133 | } |
| 134 | // Copy the elements over. No need to run dtors on PODs. |
| 135 | std::memcpy(newElts, this->BeginX, size() * typeSize); |
| 136 | } else { |
| 137 | // If this wasn't grown from the inline copy, grow the allocated space. |
| 138 | newElts = std::realloc(this->BeginX, newCapacity * typeSize); |
| 139 | if (newElts == firstEl) { |
| 140 | newElts = replaceAllocation(newElts, typeSize, newCapacity, size()); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | this->setAllocationRange(newElts, newCapacity); |
| 145 | } |
| 146 | |
| 147 | template class SmallVectorBase<uint32_t>; |
| 148 |
nothing calls this directly
no test coverage detected