Boost logo

Boost :

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

Mathias Gaunard-2 wrote
> On 16/03/12 20:55, lcaminiti wrote:
>> 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).
> Or you could change your library to explicitly require to bind member
> variables or this, like C++11 does.

But if I require ScopeExit to explicitly bind member variables or this like
C++11 lambdas do, that breaks backward compatibility with code that use the
current implementation of ScopeExit :( For example the following code that
compiles with the current version of ScopeExit will no longer compile:

struct x {
    int y;
    void f() {
        BOOST_SCOPE_EXIT( (&y) ) {
            y = -1;


View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at