On 2017-04-16 10:44, Corentin wrote: > If you want the same behavior, you can create a proxy for your associative > container instance, with a custom iterator whose operator*() returns a std > pair ( or a QPair ) - quite a bit of boilterplate code.
...or use https://github.com/Kitware/qtextensions/blob/master/core/qtEnumerate.h. Rather than returning a pair (which may add overhead), it creates a proxy that just returns the iterator, so you can write: for (auto i : qtEnumerate(my_hash)) do_stuff(i.key(), i.value()); As a plus, `key()` and `value()` are much more readable than `first` and `second`. -- Matthew _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
