diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2020-10-30 14:21:34 +0100 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-04 11:21:46 +0100 |
| commit | b76fbb48fba51df95d1776b8c1ff358789d78031 (patch) | |
| tree | 1955e13a6498318d8d485805af1558d995924829 /src/corelib/tools/qarraydataops.h | |
| parent | 419eaa0679c3867d8d9a3da8845a3015e29800d7 (diff) | |
Clean up out allocation handling
Get rid of the allocation options inside the flags
field of QArrayData, they are really a completely
separate thing.
Change-Id: I823750ab9e4ca85642a0bd0e471ee79c9cde43fb
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qarraydataops.h')
| -rw-r--r-- | src/corelib/tools/qarraydataops.h | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index a904341effe..7121da66602 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -1094,33 +1094,6 @@ public: } } - // Returns whether reallocation is desirable before adding more elements - // into the container. This is a helper function that one can use to - // theoretically improve average operations performance. Ignoring this - // function does not affect the correctness of the array operations. - bool shouldGrowBeforeInsert(const_iterator where, qsizetype n) const noexcept - { - if (this->d == nullptr) - return true; - if (this->d->flags & QArrayData::CapacityReserved) - return false; - if (!(this->d->flags & (QArrayData::GrowsForward | QArrayData::GrowsBackwards))) - return false; - Q_ASSERT(where >= this->begin() && where <= this->end()); // in range - - const qsizetype freeAtBegin = this->freeSpaceAtBegin(); - const qsizetype freeAtEnd = this->freeSpaceAtEnd(); - - // Idea: always reallocate when not enough space at the corresponding end - if (where == this->end()) { // append or size == 0 - return freeAtEnd < n; - } else if (where == this->begin()) { // prepend - return freeAtBegin < n; - } else { // general insert - return (freeAtBegin < n && freeAtEnd < n); - } - } - // using Base::truncate; // using Base::destroyAll; // using Base::assign; |
