[Development] QHash iteration vs std::unordered_map
Corentin
corentin.jabot at gmail.com
Fri Apr 21 01:57:41 CEST 2017
Here is a solution using range-v3
https://github.com/cor3ntin/qt-iterate-over-associative-containers/blob/master/main.cpp
- there is of course room for improvement :)
2017-04-20 19:28 GMT+02:00 Matthew Woehlke <mwoehlke.floss at gmail.com>:
> On 2017-04-20 13:18, Sergio Martins wrote:
> > On 2017-04-20 18:06, Matthew Woehlke wrote:
> >> for (auto i : qtEnumerate(my_hash))
> >> do_stuff(i.key(), i.value());
> >
> > That doesn't work with temporaries, does it ?
>
> No. Neither does std::add_const / qAsConst.
>
> > Maybe something to fix in the C++ language, since the usual
> > lifetime-extension tricks don't help in this case.
>
> There has been talk, but TTBOMK no concrete proposals yet. (IIRC the
> `register` proposal was published but the author decided not to present
> it yet.)
>
> --
> Matthew
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170421/a5b518ea/attachment.html>
More information about the Development
mailing list