[Interest] why does Qt prefer to return QList over QVector?

Felix morack felixover at gmail.com
Tue Jan 27 08:56:45 CET 2015


i recently gained a small, but considerable performance boost by switching
out QList for QVector in some legacy code. This is hindered by the fact
that Qt itself often returns QList, eg with QMap::values().

Is there a reason for this? Why arent QVectors used?

A somewhat related question, why is there no QList::reserve()? I guess i
see how that function might not make much sense from an algorithmic pov,
but shouldnt it at least be there as a NoOp to make it easy switching
between data structures?

best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150127/29bdaf56/attachment.html>

More information about the Interest mailing list