On 2015-07-21 01:06, Thiago Macieira wrote: > 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.
Are these still implicitly shared? Is it possible to have Qt type traits on a type T such that QList<T> will always be QVector-like? Or would it be impossible to support that in QList? (This would be for Qt 6, obviously.) It seems like it would be useful for any shared-data class to be QVector-like in QList, even if larger than a single pointer. (At least, have the ability to make such a type thusly.) ...Is QStringList going to become a QVector<QString>? -- Matthew _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
