[Interest] QVectors vs QLists
jhihn at gmx.com
Wed May 3 18:57:13 CEST 2017
I have a app that does a lot of numeric processing,using quint32, qreal mostly (and occasional QVector3D). 10k-1M items in the data set. I generally do know the size of the dataset before I start adding to it, so I call reserve() on it. Given that, and that I've been using QMap and QVector, when I use QMap and want the keys() it gives me a QList, which I then have to call toVector() on.
So this leads me to ask if I should be using QList all this time? I had thought that QList was considered harmful. 
But "everything" seems to return to me a QList, rather than a QVector.
What should I be using? (I'm Targeting 5.8 and later.)
It seems that keys() should be returning a QVector? or there should be a keysAsVector() (or a keys(QIterable *), or template) so that I don't have to pay the conversion cost twice.
 https://marcmutz.wordpress.com/2010/07/29/sneak-preview-qlist-considered-harmful/ (2010)
 http://stackoverflow.com/questions/33609406/qlist-vs-qvector-revisited (2015)
 http://lists.qt-project.org/pipermail/development/2015-July/022285.html (2017)
More information about the Interest