|
Boost : |
Subject: Re: [boost] Proposed new RAII Library
From: Sohail Somani (sohail_at_[hidden])
Date: 2012-09-16 09:54:14
On 12-09-16 9:35 AM, Krzysztof Czainski wrote:
>> >
>> >Every scope guard since the beginning of time has had a dismiss/release
>> >function.
>> >
>> >Pardon me but writing an extra line is exactly what I'm trying to avoid.
> Similarly, one might argue that every string class should have a trim
> member function, but then there are good arguments, that algorithms
> like trim should be external functions [1].
>
> So, maybe the dismiss functionality can be an external function
> (assuming a guard can be rebound to another function):
A valid argument if both methods use the same lines of code:
s.trim()
trim(s)
VS:
guard g(...);
g.dismiss();
bool dismiss=false;
guard g(...)
dismiss=true;
Sohail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk