|
Boost : |
Subject: Re: [boost] Proposed new RAII Library
From: Andrew Sandoval (sandoval_at_[hidden])
Date: 2012-09-14 14:58:21
Sohail Somani <sohail <at> taggedtype.net> writes:
> Oh, it's limited because you can't include any state in the deallocation:
>
> void youLikeThis(bool doYou,Handle h);
>
> boost::scope_guard OMGANAME(youLikeThis,true,handle);
>
> Not possible if everything is encoded in the type.
>
True, but that is why I was proposing two RAII classes. One that is limited and
uses only static values for the deleter function and the no-delete value, and
another that is much more open including state (RAIIFunction) because you can
use bind with it, and lambda's that provide any needed state.
-Andrew Sandoval
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk