From 976cf0152b52be5e30abf3b40cd80e072f0cbfd6 Mon Sep 17 00:00:00 2001 From: Andrei Golubev Date: Wed, 16 Jun 2021 11:31:57 +0200 Subject: 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 --- src/corelib/tools/qlist.qdoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/corelib/tools') 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() */ -- cgit v1.2.3