diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-10-17 15:47:41 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-12-07 14:18:28 +0100 |
commit | 551c665b7d3730e45e99dc87ccc144dd53f8e432 (patch) | |
tree | 652e1ba11bfd79e0ccbe708c3e926f9008ae2f83 | |
parent | f6a151024b03158bcf46dc86e346d4227f8ca9d4 (diff) |
Remove unused private method
Change-Id: I3502c3c0451e7829fff0159a5d0891df34d04fe7
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r-- | src/corelib/tools/qvector.h | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 2be7fa01e0..8bd350e6eb 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -301,9 +301,6 @@ public: inline QVector<T> toVector() const { return *this; } private: - // ### Qt6: remove methods, they are unused - void reallocData(const int size, const int alloc, QArrayData::ArrayOptions options = QArrayData::DefaultAllocationFlags); - void reallocData(const int sz) { reallocData(sz, d->allocatedCapacity()); } void realloc(int alloc, QArrayData::ArrayOptions options = QArrayData::DefaultAllocationFlags); void freeData(Data *d); void defaultConstruct(T *from, T *to); @@ -575,105 +572,6 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_MSVC(4127) // conditional expression is constant #endif -template <typename T> -void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::ArrayOptions options) -{ - Q_ASSERT(asize >= 0 && asize <= aalloc); - Data *x = d; - - const bool isShared = d->ref.isShared(); - - if (aalloc != 0) { - if (aalloc != int(d->allocatedCapacity()) || isShared) { - QT_TRY { - // allocate memory - x = Data::allocate(aalloc, options); - Q_CHECK_PTR(x); - // aalloc is bigger then 0 so it is not [un]sharedEmpty - Q_ASSERT(!x->ref.isStatic()); - x->size = asize; - - T *srcBegin = d->begin(); - T *srcEnd = asize > d->size ? d->end() : d->begin() + asize; - T *dst = x->begin(); - - if (!QTypeInfoQuery<T>::isRelocatable || (isShared && QTypeInfo<T>::isComplex)) { - QT_TRY { - if (isShared || !std::is_nothrow_move_constructible<T>::value) { - // we can not move the data, we need to copy construct it - while (srcBegin != srcEnd) - new (dst++) T(*srcBegin++); - } else { - while (srcBegin != srcEnd) - new (dst++) T(std::move(*srcBegin++)); - } - } QT_CATCH (...) { - // destruct already copied objects - destruct(x->begin(), dst); - QT_RETHROW; - } - } else { - ::memcpy(static_cast<void *>(dst), static_cast<void *>(srcBegin), (srcEnd - srcBegin) * sizeof(T)); - dst += srcEnd - srcBegin; - - // destruct unused / not moved data - if (asize < d->size) - destruct(d->begin() + asize, d->end()); - } - - if (asize > d->size) { - // construct all new objects when growing - if (!QTypeInfo<T>::isComplex) { - ::memset(static_cast<void *>(dst), 0, (static_cast<T *>(x->end()) - dst) * sizeof(T)); - } else { - QT_TRY { - while (dst != x->end()) - new (dst++) T(); - } QT_CATCH (...) { - // destruct already copied objects - destruct(x->begin(), dst); - QT_RETHROW; - } - } - } - } QT_CATCH (...) { - Data::deallocate(x); - QT_RETHROW; - } - } else { - Q_ASSERT(int(d->allocatedCapacity()) == aalloc); // resize, without changing allocation size - Q_ASSERT(isDetached()); // can be done only on detached d - Q_ASSERT(x == d); // in this case we do not need to allocate anything - if (asize <= d->size) { - destruct(x->begin() + asize, x->end()); // from future end to current end - } else { - defaultConstruct(x->end(), x->begin() + asize); // from current end to future end - } - x->size = asize; - } - } else { - x = Data::sharedNull(); - } - if (d != x) { - if (!d->ref.deref()) { - if (!QTypeInfoQuery<T>::isRelocatable || !aalloc || (isShared && QTypeInfo<T>::isComplex)) { - // data was copy constructed, we need to call destructors - // or if !alloc we did nothing to the old 'd'. - freeData(d); - } else { - Data::deallocate(d); - } - } - d = x; - } - - Q_ASSERT(d->data()); - Q_ASSERT(d->size <= int(d->allocatedCapacity())); - Q_ASSERT(aalloc ? d != Data::sharedNull() : d == Data::sharedNull()); - Q_ASSERT(int(d->allocatedCapacity()) >= aalloc); - Q_ASSERT(d->size == asize); -} - template<typename T> void QVector<T>::realloc(int aalloc, QArrayData::ArrayOptions options) { |