From d9c40cf90ec43c0e26b62d5d14feb89aac44aa63 Mon Sep 17 00:00:00 2001 From: Andrei Golubev Date: Wed, 8 Jul 2020 14:26:34 +0300 Subject: [PATCH] Remove the setting of GrowsBackwards from QList The flag is practically unused, there is no logic that relies on its existence. From experience of prototyping prepend optimization (where the flag actually makes sense), it is better to temporarily remove it: QList is, in fact, unaware of how to correctly use it at the moment Once GrowsBackwards-using code is implemented at the lower levels, the usage of the flag will be reintroduced to QList along with the changes that ensure correct behavior Task-number: QTBUG-84320 Change-Id: I618adfcd69b15c76ddafd78cca5e9aa0073e4c91 Reviewed-by: Thiago Macieira --- src/corelib/tools/qlist.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index c2e5e12a1d..0078f87cce 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -591,8 +591,6 @@ QList::insert(qsizetype i, qsizetype n, parameter_type t) const size_t newSize = size() + n; if (d->needsDetach() || newSize > d->allocatedCapacity()) { typename Data::ArrayOptions flags = d->detachFlags() | Data::GrowsForward; - if (size_t(i) <= newSize / 4) - flags |= Data::GrowsBackwards; DataPointer detached(Data::allocate(d->detachCapacity(newSize), flags)); const_iterator where = constBegin() + i; @@ -622,8 +620,6 @@ QList::emplace(qsizetype i, Args&&... args) const size_t newSize = size() + 1; if (d->needsDetach() || newSize > d->allocatedCapacity()) { typename Data::ArrayOptions flags = d->detachFlags() | Data::GrowsForward; - if (size_t(i) <= newSize / 4) - flags |= Data::GrowsBackwards; DataPointer detached(Data::allocate(d->detachCapacity(newSize), flags)); const_iterator where = constBegin() + i;