|
Boost : |
Subject: Re: [boost] Proposed new RAII Library
From: Sohail Somani (sohail_at_[hidden])
Date: 2012-09-14 14:48:58
On 14/09/2012 2:37 PM, Alexander Nasonov wrote:
> And then:
>
> bool dismiss = false;
>
> ...
>
> UNARY_SCOPE_EXIT(dismiss, CloseHandle, handle);
>
> ...
>
> dismiss = true;
What. Are you really trying to make a case against:
boost::scope_guard kanyewest(CloseHandle,handle);
...
kanyewest.dismiss();
Or in C++11:
boost::scope_guard lolwhat( [&](){ CloseHandle(handle); } );
...
lolwhat.dismiss();
Macros are magic and I concur with the other poster that unless the
magic cannot be avoided, don't rely on it.
I'm not sure why this is so hard. People who use this pattern find it
more useful that BOOST_SCOPE_EXIT. People who don't, don't. Film at 11.
Sohail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk