Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-10-20 04:50:25


"Michael Glassford" <glassfordm_at_[hidden]> writes:

> I'm a bit late getting in on this, but I also have a "Boostified" scope
> guard, which I've attached. It's based on the ScopeGuard class in the CUJ
> article with these differences:
>
> * It uses the Boost preprocessor library to eliminate code repetition.
>
> * It uses the Boost preprocessor library's BOOST_PP_CAT to generate the
> hidden variable name for the ON_BLOCK_EXIT and ON_BLOCK_EXIT_OBJ macros
> (which I've renamed BOOST_GUARD_FN and BOOST_GUARD_MEM_FN). However, this
> has some problems on VC++ 6.
>
> * It uses boost::ref(), boost::cref(), and boost::noncopyable instead of
> implementing these features on its own.

Either I'm missing something, or great swaths of code could be
eliminated simply by asking people to use Boost.Bind (or lambda, for
that matter). For example, guard_mem_fn seems unneeded. Am I wrong?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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