1 #ifndef MSP_CORE_RAII_H_
2 #define MSP_CORE_RAII_H_
7 Sets a value for the duration of a scope. The old value is restored when the
18 SetForScope(T &r, T v): ref(r), old(r) { ref = v; }
19 ~SetForScope() { ref = old; }
22 class SetFlag: public SetForScope<bool>
25 SetFlag(bool &r, bool v = true): SetForScope<bool>(r, v) { }