[Interest] Interest Digest, Vol 114, Issue 23

Thiago Macieira thiago.macieira at intel.com
Thu Mar 25 00:05:00 CET 2021


On Tuesday, 23 March 2021 06:25:09 PDT Matthew Woehlke wrote:
> Why is QList removed? (I don't mean the *name* "QList", I mean the
> container with indirect storage and reference stability. It's useful,
> and unlike QHash, there is no STL equivalent available.)

Because everyone kept complaining that it was wrong. See Marc's blog[1] for 
detailed information. Aside from a very few narrow cases (the ones you likely 
want), it was the wrong container. It was occupying the most common container 
name in the API and because of that it was used everywhere. Quite a few of 
those APIs in Qt itself were stumbling in their use of QList and were in the 
not-optimal case. 

QList<int> was not optimal.
QList<QVariant> (a.k.a. QVariantList) was not optimal.
QList<QString> (the 3-pointers QString from Qt 6) would not have been optimal.

So QList's implementation had to be replaced. The one in QVector was the one 
deemed "safest default for the majority of uses" so that's why QList == 
QVector in Qt 6.

That left the question of whether we needed to provide a container that did 
what QList did: indirect, stable references. We concluded we did not, the use-
cases were too few and far between to provide in the Qt API. But *adding* a 
new container is not difficult, if there's sufficient reason.

[1] https://marcmutz.wordpress.com/2010/07/29/sneak-preview-qlist-considered-harmful/
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering





More information about the Interest mailing list