[Interest] QMap::keys() / Qt6
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Tue Jan 2 12:07:00 CET 2018
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 conversions
>
> Is 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 | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180102/8f49af61/attachment.bin>
More information about the Interest
mailing list