
14 Sep
2012
14 Sep
'12
6:48 p.m.
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