QSqlIndex: replace QList<bool> with QVector<bool>

QList<bool> uses from 400% (32-bit platforms) to 800% (64-bit)
more per-element memory than QVector<bool>.

This change is binary compatible, since QList and QVector have
the same size, and the QList field was not referenced from
inline functions. This includes all relevant special member
functions, since they are all out-of-line (and move assignment
and move constructor are disabled by used-defined copy
assignment and copy constructors, resp.). The header is unchanged
from Qt 5.0, so there were also no past inline users of the
member.

Change-Id: I3a94ddc73a4f388031dfd4fce3fedccc507a39c7
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
bb10
Marc Mutz 2015-06-15 13:00:37 +02:00
parent 027571c8c3
commit 435a3d7741
2 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,9 @@
QT_BEGIN_NAMESPACE
// ### Qt 6: remove the static assertion, the 'sorts' field was changed from QList to QVector in Qt 5.6
Q_STATIC_ASSERT((sizeof(QList<bool>) == sizeof(QVector<bool>)));
/*!
\class QSqlIndex
\brief The QSqlIndex class provides functions to manipulate and

View File

@ -36,7 +36,10 @@
#include <QtSql/qsqlrecord.h>
#include <QtCore/qstring.h>
#include <QtCore/qvector.h>
#if QT_DEPRECATED_SINCE(5,6)
#include <QtCore/qlist.h>
#endif
QT_BEGIN_NAMESPACE
@ -63,7 +66,7 @@ private:
QString createField(int i, const QString& prefix, bool verbose) const;
QString cursor;
QString nm;
QList<bool> sorts;
QVector<bool> sorts;
};
QT_END_NAMESPACE