[Development] HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO
Thiago Macieira
thiago.macieira at intel.com
Tue Jul 21 07:06:16 CEST 2015
On Tuesday 21 July 2015 02:26:41 Kevin Kofler wrote:
> For the implicitly shared data types, QList actually does NOT add another
> layer of indirection (as documented: "If T is itself a pointer type or a
> basic type that is no larger than a pointer, or if T is one of Qt's shared
> classes, then QList<T> stores the items directly in the pointer array."),
> so in that case, it is almost the same as QVector, except that it allows
> prepending items much more efficiently (O(1) in many cases, whereas it's
> always O(n) in QVector).
Except if the type is larger than sizeof(void*), like QVariant is.
Or like QString and QByteArray will be in Qt 6.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list