[Interest] QMap::keys() / Qt6

Jason H jhihn at gmx.com
Tue Jan 2 18:37:44 CET 2018


> 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?


I complained about a lack of a generic iterator class back in the spring of last year[1]. Thiago seems to have one waiting for Qt6, because as a developer, I don't want to to care what kind of iterable you pass to me, I just want to iterate on it. 

[1] http://lists.qt-project.org/pipermail/development/2017-April/029556.html




More information about the Interest mailing list