Boost logo

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);


Or in C++11:

   boost::scope_guard lolwhat( [&](){ CloseHandle(handle); } );


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.


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