Subject: Re: [boost] [scope_exit] can MSVC lambdas capture data members?
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2012-03-14 21:45:50
> Nathan Ridge wrote
> > GCC 4.5 is in error to allow that. 4.7 does not allow it.
> > The correct way to use a data member in the lambda is to capture "this",
> > and then
> > access the member via "this->member" inside the lambda.
If the above it true ...
> Works with the current implementation of ScopeExit that does not use lambdas
> but it will no longer compile with the implementation of ScopeExit that uses
> lambdas. Therefore, the lambda implementation of ScopeExit cannot be
> backward compatible... I will discuss this issue with ScopeExit's main
> author Alexander Nasonov but this might mean that ScopeExit will never be
> implemented internally using lambdas, not even on C++11 compilers.
then don't claim backward-compatibility and make sure that lambda
implementation can't be implicitly enabled (only if a user defines
BOOST_SCOPE_EXIT_USE_LAMBDAS or something like this).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk