Change QVector's in-memory data layout
authorJoão Abecasis <joao.abecasis@nokia.com>
Fri, 17 Feb 2012 11:10:03 +0000 (12:10 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 22 Feb 2012 16:37:29 +0000 (17:37 +0100)
commita1621d235dad75b8042f4e13712e1ea3440bf717
treebd15927fd90a423745bf3004a96ad4c2e93f5d74
parenta5233b6b22e20bf249d8ae993a4224c6874abccf
Change QVector's in-memory data layout

The new layout matches that of QByteArrayData and QStringData, except
for offset which is measured from the beginning of QVectorData, whereas
in those classes it (still?) references the end of the header data.

The new layout uses an extra member for storing an offset into the data,
which will allow introducing QVector::fromRawData, similar to the same
functionality already existing in QString and QByteArray.

By not using an actual array to index array members, we also steer clear
of GCC bug #43247:

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247

Change-Id: I408915aacadf616b4633bbbf5cae1fc19e415087
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/tools/qvector.h
tests/benchmarks/corelib/tools/qvector/qrawvector.h