| 3390 | */ |
| 3391 | template <class DataType> |
| 3392 | void 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 | |