[Development] QList

Thiago Macieira thiago.macieira at intel.com
Tue Apr 25 21:35:01 CEST 2017

On Tuesday, 25 April 2017 15:45:12 -03 Matthew Woehlke wrote:
> Maybe an alternate approach makes sense?
> 1. Rename QList -> QArrayList.
> 2. Remove special case of inline storage.
> 3. Add QList<T> as an alias to either QArrayList<T> or QVector<T>
> depending on T.

QVector and QList don't have the same API. They're slightly different. What'sm 
ore, QList has a beginning-of-list optimisation, whereas QVector doesn't (not 
even my copy, I stopped development shortly before I got to that part, even if 
I did add a QArrayData::GrowsBackward flag to support the case).

Also note that QList<char> is different from QVector<char>. QList<T> would 
need to be backed by QVector<quintptr> and a proper casting.

We can't use an alias either, we'd need a full class, with constructors, 
destructors, etc., to keep binary compatibility. And I don't think we can keep 
data compatibility, as QList's internals are very different from QVector's 
(different shared_null, different allocation strategies, different 
deallocation function, etc.).

So, no, we can't implement that in Qt 5. In Qt 6, we've already agreed we 
don't want this mess, so QList as it is simply goes away.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list