summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-06-16 11:31:57 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2021-06-17 17:44:52 +0200
commit976cf0152b52be5e30abf3b40cd80e072f0cbfd6 (patch)
treec8e8fb0090e7ca512e6497449a6fcb099c7471ec
parent52b2346742ec025d0ec54070d85013522327828a (diff)
QList: more explicitly document capacity() shenanigans
Due to capacity() reporting the size of all allocated space, this is somewhat inconsistent with what QVector::capacity() in Qt5 provided, due to Q6List being double-ended. So let's document this better Task-number: QTBUG-92941 Pick-to: 6.2 Change-Id: Iba46389121e721a8d21f0344b154f41c2c245867 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/tools/qlist.qdoc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc
index 88c8ca3dc5..a364cb1497 100644
--- a/src/corelib/tools/qlist.qdoc
+++ b/src/corelib/tools/qlist.qdoc
@@ -485,9 +485,10 @@
\note a statically allocated list will report a capacity of 0,
even if it's not empty.
- \note The free space position in the allocated memory block is undefined. In
- other words, one should not assume that the free memory is always located
- after the initialized elements.
+ \warning The free space position in the allocated memory block is undefined.
+ In other words, you should not assume that the free memory is always located
+ at the end of the list. You can call reserve() to ensure that there is
+ enough space at the end.
\sa reserve(), squeeze()
*/