MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / preallocateGrow

Method preallocateGrow

3rdparty/qcustomplot/qcustomplot.h:3392–3405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3390*/
3391template <class DataType>
3392void QCPDataContainer<DataType>::preallocateGrow(int minimumPreallocSize)
3393{
3394 if (minimumPreallocSize <= mPreallocSize)
3395 return;
3396
3397 int newPreallocSize = minimumPreallocSize;
3398 newPreallocSize += (1u<<qBound(4, mPreallocIteration+4, 15)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
3399 ++mPreallocIteration;
3400
3401 int sizeDifference = newPreallocSize-mPreallocSize;
3402 mData.resize(mData.size()+sizeDifference);
3403 std::copy_backward(mData.begin()+mPreallocSize, mData.end()-sizeDifference, mData.end());
3404 mPreallocSize = newPreallocSize;
3405}
3406
3407/*! \internal
3408

Callers

nothing calls this directly

Calls 4

resizeMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected