From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-05-15 01:27:43
"Andrei Alexandrescu wrote:
> > Multi index container library includes ScopeGuard (almost verbatim
> > from Andrei) until some boost-wide solution appears.
> What does it/should it do if the guard function throws an exception? Is
> there some try/catch in ScopeGuard's destructor?
> I was never sure what to do there. You can't pass an error out, you can't
> throw... and to keep the library general, you can't do something like
> logging or writing to cerr. Any ideas?
The implementation in multi index container does not contain try/catch.
My personal opinion is to keep it this way:
- adding try/catch would add overhead, significant
for simple operations
- now it has (nearly) the same semantics as old
fashioned manual handling:
behaves like hand written:
if (!my_flag) foo();
Overload can be added:
ScopeGuard<nothrow> = makeGuard<nothrow>(..)
for other cases.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk