[Development] QHash iteration vs std::unordered_map

Matthew Woehlke mwoehlke.floss at gmail.com
Thu Apr 20 19:28:27 CEST 2017

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.)


More information about the Development mailing list