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 <[email protected]>: > 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 > [email protected] > http://lists.qt-project.org/mailman/listinfo/development >
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
