diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-06-16 11:31:57 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-17 15:54:13 +0000 |
commit | b3c4ee46f7b601677178baca94b803b2f7c2c1bb (patch) | |
tree | 38c56d700375e01dceed29d64873fbf82ad5d8cd /src | |
parent | ac1c433c83d3822cf9d879ba581fea9afd17c23b (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
Change-Id: Iba46389121e721a8d21f0344b154f41c2c245867
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 976cf0152b52be5e30abf3b40cd80e072f0cbfd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qlist.qdoc | 7 |
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() */ |