Boost logo

Boost :

Subject: Re: [boost] [scope_exit] can MSVC lambdas capture data members?
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-03-16 15:55:38


Dave Abrahams wrote
>
> on Fri Mar 16 2012, Mathias Gaunard <mathias.gaunard-AT-ens-lyon.org>
> wrote:
>
>> On 16/03/12 03:42, Alexander Nasonov wrote:
>>
>>> If we assume that the new standard is immutable, then you reasoning
>>> makes perfect sense. However, what if it was an oversight by the
>>> standard committee? 'this' is not a local variable, after all. If they
>>> allowed a special case for this, they could also allow data members.
>>
>> It is not an oversight, and is this way on purpose.
>

Does anyone know what was the rationale of the committee for this?

> That may be, but it is considered a mistake by at least a few of us on
> the commitee, and we've discussed ways to rectify it.
>

Then, as Alex suggested, I will leave the BOOST_SCOPE_EXIT implementation
that uses lambdas however it will be disabled by default, enabled only if
users explicitly #define BOOST_SCOPE_EXIT_CONFIG_USE_CXX11_LAMBDAS, and I
will document that BOOST_SCOPE_EXIT with lambdas is not backward compatible
(unless C++11 is rectified to allow lambdas to capture data members).

Thanks a lot.
--Lorenzo

--
View this message in context: http://boost.2283326.n4.nabble.com/boost-scope-exit-can-MSVC-lambdas-capture-data-members-tp4472788p4479186.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk