Boost logo

Boost :

Subject: Re: [boost] Proposed new RAII Library
From: Andrew Sandoval (sandoval_at_[hidden])
Date: 2012-09-14 17:02:48


Vicente J. Botet Escriba <vicente.botet <at> wanadoo.fr> writes:

> I don't know if I will use in my code the proposed scope_guard interface
> having as parameters a function and its arguments, as in
>
> boost::scope_guard kanyewest(CloseHandleIfNot, dismiss, handle);

Vincente: I am a little confused. Are you suggesting that you will write these
new classes, or that I should put this in mine? The one I sent originally has a
dismiss method, it's just called Cancel(). It also has operator=.

And while it would only work with C++11 compilers using lambdas, if you were
using boost::bind it would work with C++03 compilers as well.

Since I proposed this I will work on changing my two classes (RAIIWrapper and
RAIIFunction) so that they comply better with the C++ Library standards
(nomenclature, etc.) and I will submit that for review. I am completely open
however to putting it an existing library, though I think it might help if we
Boost had an RAII library that contained these two classes AND in the
documentation links to other RAII containers like scoped_ptr, shared_ptr, and
Boost.ScopedExit.

-Andrew Sandoval


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