
14 Sep
2012
14 Sep
'12
9:44 p.m.
On Friday 14 September 2012 21:25:44 Andrew Sandoval wrote:
It's a better solution for most things, but there are cases where RAIIFunction with a lambda or a function produced by bind are more desirably, and the user will need to understand the risks -- which in the large major of cases are next to nil anyway, before they elect to use RAIIFunction.
The probability of exception doesn't matter. Scope guards (or RAIIFunction) are typically used to implement exception safety, so introducing the possibility of exception from the scope guard itself sort of defeats its purpose. At the very least, it will complicate usage - probably, more than it will simplify one. IMHO, this tool should not be based on boost/std::function.