| 105 | // Note: Moving this function into the header may cause performance regression. |
| 106 | template<class Size_T> |
| 107 | void* SmallVectorBase<Size_T>::mallocForGrow(void* firstEl, std::size_t minSize, std::size_t typeSize, std::size_t& newCapacity) { |
| 108 | newCapacity = getNewCapacity<Size_T>(minSize, typeSize, this->capacity()); |
| 109 | // Even if capacity is not 0 now, if the vector was originally created with |
| 110 | // capacity 0, it's possible for the malloc to return FirstEl. |
| 111 | void* newElts = std::malloc(newCapacity * typeSize); |
| 112 | if (newElts == firstEl) { |
| 113 | newElts = replaceAllocation(newElts, typeSize, newCapacity); |
| 114 | } |
| 115 | return newElts; |
| 116 | } |
| 117 | |
| 118 | // Note: Moving this function into the header may cause performance regression. |
| 119 | template<class Size_T> |
nothing calls this directly
no test coverage detected