Boost logo

Boost :

Subject: Re: [boost] [scope_exit] Doesn't included in Boost yet?
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2009-01-14 08:31:36


On Wed, Jan 14, 2009 at 1:04 PM, Alexander Nasonov <alnsn_at_[hidden]> wrote:
> Philippe Vaucher <philippe.vaucher <at> gmail.com> writes:
>
>> I second that. I think we can always "0xize" the library later on, and
>> probably that boost is going to change a little when C++0x arrives anyway so
>> this could be part of that process.
>
> Beman gave me permission to commit the library. I'll do it tonight.
>
> Regarding "0xfication", see my other post for capture list syntax.
>
> C++0x code will be nicer:
>
> BOOST_SCOPE_EXIT(&a, &b, c)
> {
> std::cout << a << '\n' << b << '\n' << c << '\n';
> }
>
> Variadic pp args and no BOOST_SCOPE_EXIT_END after the closing bracket.
>

Why declare the captured variables at all? What is the benefit? In
c++0x this should be possible:

BOOST_SCOPE_EXIT {
  //code here
}

A ScopeExit never outlives the containing scope, so capturing by
reference the whole frame should be always safe.

-- 
gpd

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