Boost logo

Boost :

Subject: Re: [boost] [scope_exit] Doesn't included in Boost yet?
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2009-01-14 08:41:02


Giovanni Piero Deretta <gpderetta <at> gmail.com> writes:

> Why declare the captured variables at all? What is the benefit? In
> c++0x this should be possible:
>
> BOOST_SCOPE_EXIT {
> //code here
> }

// Capture all local variables inside the block by reference:
BOOST_SCOPE_EXIT(&) {
}

// Capture all local variables inside the block by value:
BOOST_SCOPE_EXIT(=) {
}

// Capture a and b by reference, c by value,
// all other local variables by reference
BOOST_SCOPE_EXIT(&, &a, &b, c) {
}

// Capture a and b by reference, c by value,
// all other local variables by value
BOOST_SCOPE_EXIT(=, &a, &b, c) {
}

Alex


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