
16 Sep
2012
16 Sep
'12
1:54 p.m.
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