|
Boost : |
From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2005-01-09 10:56:38
"Jason Hise" wrote:
> Actually, that try block exists for only the specific case when the
> constructor throws... I'm not sure how it could be implemented via RAII,
> as dependencies should only be decremented upon failure. The dtor itself,
> and thus ReleaseDependency, should not be called if new or the ctor
> throws.
>
struct undoer_t {
int* value;
undoer_t(int* val) value(val) {}
~undoer_t() { if (value) --*value; }
void dismiss() { value = 0; }
} undoer(&dependents);
..... possibly throwing operation
undoer.dismiss();
/Pavel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk