qt6-bb10/tests/auto/corelib/tools/qvector
Marc Mutz a7885c9756 QVector: preserve capacity in clear()
This is what std::vector implementations usually do,
because it minimizes memory fragmentation and useless
allocations since no user will call clear() unless
she intends to append new data afterwards.

Fix calls to resize(0) that show how existing code
tried to work around the issue.

Adjust test. Port from QVERIFY(==) to QCOMPARE as a
drive-by.

[ChangeLog][QtCore][QVector] clear() now preserves
capacity. To shed capacity, call squeeze() or swap
with a default-constructed QVector object, see the
documentation for an example.

Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-29 07:57:47 +00:00
..
.gitignore Moving relevant tests to corelib/tools 2011-09-01 13:07:23 +02:00
qvector.pro Tests: Remove CONFIG += parallel_test. 2015-09-05 07:16:50 +00:00
tst_qvector.cpp QVector: preserve capacity in clear() 2016-02-29 07:57:47 +00:00