[Development] QList for Qt 6
giuseppe.dangelo at kdab.com
Wed May 22 20:14:08 CEST 2019
Il 22/05/19 15:49, Lars Knoll ha scritto:
> 1. Rename QList to QArrayList and make QList an alias to QArrayList
> 2. Move QStringList and QByteArrayList over to inherit from QVector (that should be source compatible)
> 3. Rename QStringList to QStringVector (keep QStringList as a compatibility name), same for QBAList
> 4. Use QVector to implement QList<Foo>, if sizeof(Foo) <= sizeof(quint64) and Foo is movable. I’m intentionally not using sizeof(void *) here, as types with sizes between 4 and 8 bytes would not have stable references in cross platform code, so I do not believe lots of code would assume that (or it would have broken on 64 bit).
I'd argue to simply leave QList alone. There's little point at doing
refactorings on it; if the idea is to keep it just as deprecated
compatibility measure, why touching it at all? And why changing its
behavior in any way if it's meant for _compatibility_?
(That's also why I'd prefer the name Qt5List or something like that.)
> 5. Add a compile time switch that allows mapping QList completely to QVector or to a compatibility mode where QLists of large/non movable types are mapped to QArrayList
So this switch has three positions:
1) QList = QArrayList (default)
2) QList = QVector for small+movable types, QArrayList otherwise
3) QList = QVector
> 6. For now we don’t yet want to explicitly change all our API that uses QList to use QVector (as that would make merging from dev a pain, let’s do that later this year). But to test that everything we have works with QVector, we’ll set the compile switch to default to mapping to QVector.
And add implicit conversions (on QArrayList) from/to QVector.
> 7. Make the implementation of QArrayList fully inline and deprecate the class.
Why fully inline?
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4329 bytes
Desc: Firma crittografica S/MIME
More information about the Development