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

Matthew Woehlke mw_triad at users.sourceforge.net
Fri May 15 16:42:54 CEST 2015

On 2015-05-14 16:37, Thiago Macieira wrote:
> On Thursday 14 May 2015 11:34:25 Matthew Woehlke wrote:
>> On 2015-05-14 10:58, Thiago Macieira wrote:
>>> On Thursday 14 May 2015 14:36:43 Olivier Goffart wrote:
>>>> I'm afraid your solution is not working with temporaries containers.
>>> That should be submitted as a change request to the standard. There are a
>>> couple of other cases where this bites people.
>>> It needs a new paper.
>> Can you (both) please elaborate?
>> That's... interesting. I'm taking a copy of the container and taking
>> iterators from the copy. It seems to me that the RHS expression in a
>> range-based for should most definitely not go out of scope within the
>> for. Is that not the case? (Does range-based for just not work on
>> temporaries at all?)
> for (auto x : function(function2()))
> If function returns a temporary and function passes through a reference, [...]

Er... wait. My bad. Does it resolve the issue if 'Container const& c;'
in qtEnumerator is changed to be a copy (i.e. remove the '&') rather
than a reference? (I was thinking it was a copy when I wrote the above,
and, given that this is likely only going to be used on Qt containers,
it probably ought to be a copy.)

Back on the subject of C++ standard proposals, I thought there was
already a proposal regarding lifetime extension of temporaries? (Or did
that die? Or not cover this use case?)


More information about the Development mailing list