[Development] Proposal: Deprecating platforms in Qt 5.6 that don't support lambda

Matthew Woehlke mw_triad at users.sourceforge.net
Wed May 13 15:45:30 CEST 2015

On 2015-04-30 16:04, Matthew Woehlke wrote:
> On 2015-02-20 14:42, Thiago Macieira wrote:
>> On Friday 20 February 2015 12:53:24 Matthew Woehlke wrote:
>>>   for (auto const i : qtEnumerate(map))
>>> Maybe it would be nice for Qt to provide one or both of these?
>> Sounds easy enough. Want to give it a try?
> I *finally* got permission to share this. Sorry it took so long.
> The attached code, excluding the copyright notices, is hereby placed
> into the Public Domain. Permission is also granted to use the attached
> code under either the BSD license, as stated in the files themselves, or
> pursuant to Kitware's CLA with Qt.
> It is my hope that this is useful to other people. (Also that the first
> one finds its way into STL eventually :-), though that's a bit OT for here.)
> These are both C++11 code. At minimum, they'll need brace-initialization
> changed to parentheses-initialization in order to build in C++03 mode.
> However, qtIndexRange also uses trailing return type specification, and
> I'm not sure it's possible to avoid that without losing type deduction,
> which sort-of defeats the purpose. There are also lots of elided type
> specifiers, though those are easy enough to add.
> Personally, I wouldn't consider it a terrible loss if these were only
> available in C++11-or-later mode, since they're intended to be used with
> range-based for.
>> Note that this should also work for foreach:
>> 	foreach (const auto i, qtEnumerate(map))
> I'm not sure if it will or not; it was designed to work in range-based
> for, i.e. it supplies begin() and end(). I'm not sure if that's enough
> to automagically work in Q_FOREACH.
> Thiago, do you want me to take another look at integrating these into Qt
> proper, or do you have it in hand?



More information about the Development mailing list