-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
4.7.0, 4.8.2
-
None
Consider the following test:
QVector<float> empty; QVector<float> buf; buf.reserve(45); QVERIFY(buf.capacity() == 45); buf.append(2.5); buf.append(10.7); QVERIFY(buf.capacity() == 45); buf << empty; qDebug() << buf.capacity(); QVERIFY(buf.capacity() == 45);
In my mind this test should pass, but the QDebug prints a capacity of 2 and the test fails. It seems that QVector reallocates to the size of this vector plus the size of the appended vector even when there is sufficient capacity to hold the new elements.
- replaces
-
QTBUG-25371 QVector += QVector destroys pre-allocation
-
- Closed
-