add new exception-safe RAII object, that increments/decrements its argument
This commit is contained in:
parent
842fa3c708
commit
20997dfa78
@ -34,6 +34,16 @@ class /*LIBPBD_API*/ Unwinder {
|
||||
T _old_val;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class /*LIBPBD_API*/ ExceptionSafeIncDec {
|
||||
public:
|
||||
ExceptionSafeIncDec (T& var) : _var (var) { _var++; }
|
||||
~ExceptionSafeIncDec () { _var--; }
|
||||
|
||||
private:
|
||||
T& _var;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* __libpbd_unwinder_h__ */
|
||||
|
Loading…
Reference in New Issue
Block a user