helper class to set value on construction and reset to previous value on destruction. (RAII-idiom) More...
#include <util.h>
Public Member Functions | |
cSetValueTemporarily (T *_value_ptr, T new_value) | |
CTOR: remember current value of _value_ptr and set it to new_value. | |
~cSetValueTemporarily () | |
DTOR: restore the remembered value. | |
Private Attributes | |
T | old_value |
T * | value_ptr |
helper class to set value on construction and reset to previous value on destruction. (RAII-idiom)
cSetValueTemporarily< T >::cSetValueTemporarily | ( | T * | _value_ptr, |
T | new_value | ||
) | [inline] |
cSetValueTemporarily< T >::~cSetValueTemporarily | ( | ) | [inline] |
T cSetValueTemporarily< T >::old_value [private] |
T* cSetValueTemporarily< T >::value_ptr [private] |