summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2020-11-27 19:37:11 +0100
committerIvan Solovev <ivan.solovev@qt.io>2020-12-02 09:30:29 +0100
commit6364194456ec92a2c09a339d20b868bb49bd00e9 (patch)
tree15726caaff6f258f6c0559b718e9388c203c0cb5 /src
parent5545b0f1d3ae6e0f4db56484debe3ac0f25635ed (diff)
QList docs: extend prepend() description
Current description was confronting the general description of the class, which states that prepend() is fast. The updated description gives more information about the method's behavior in different conditions. Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: I7b6dfb536d143d78c441214f83320c1bf1263e0d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qlist.qdoc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc
index 6469d52eed..f0a6db15cd 100644
--- a/src/corelib/tools/qlist.qdoc
+++ b/src/corelib/tools/qlist.qdoc
@@ -681,11 +681,12 @@
This is the same as list.insert(0, \a value).
- For large lists, this operation can be slow (\l{linear time}),
- because it requires moving all the items in the list by one
- position further in memory. If you want a container class that
- provides a fast prepend operation, use std::list
- instead.
+ Normally this operation is relatively fast (amortized \l{constant time}).
+ QList is able to allocate extra memory at the beginning of the list data
+ and grow in that direction without reallocating or moving the data on each
+ operation. However if you want a container class with a guarantee of
+ \l{constant time} prepend, use std::list instead,
+ but prefer QList otherwise.
\sa append(), insert()
*/