
9 Jan
2005
9 Jan
'05
3:56 p.m.
"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