Hi, Il 01/01/2018 20:59, Christian Ehrlicher ha scritto:
currently QMap::keys() returns a QList<T>. Since some newer APIs already using QVector, a conversion from QList to QVector is needed which creates a double allocation when using the easy way (with a clazy warning and hopefully a comment in the review). So to avoid this, I have to write some code to put the keys into a QVector. The problems I've with this solutions are - everyone needs to write his own function - it is (maybe) not catched during Qt6 porting, esp. when using auto, and we do useless conversionsIs it possible to add a helper function for this somewhere (or is it already available) or another easier way?
Please move this discussion to the development@ mailing list, as it's about development OF Qt, rather than development WITH Qt.
About your question, I don't think there is any convenience, public or private. If you feel this is going to be needed in more than one place, feel free to add a small function in the QtPrivate namespace (create the vector, reserve its capacity, copy using a key iterator). We're still debating what the future of QVector/QList will be...
My 2 cents, -- Giuseppe D'Angelo | [email protected] | Senior Software Engineer KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 KDAB - Qt, C++ and OpenGL Experts
smime.p7s
Description: Firma crittografica S/MIME
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
