Data-based RAII scope guard. More...
#include <guard_value.hpp>
Public Member Functions | |
| guard_value (T &ref, T new_val) | |
| ~guard_value () | |
Private Attributes | |
| T * | ref_ |
| T | old_val_ |
Data-based RAII scope guard.
Assigns a value to a specific location, then restores the old value once it goes out of scope.
Definition at line 24 of file guard_value.hpp.
|
inline |
| ref | The memory location being guarded |
| new_val | The new value to temporarily assign to that location |
Definition at line 32 of file guard_value.hpp.
|
inline |
Definition at line 38 of file guard_value.hpp.
References utils::guard_value< T >::old_val_, and utils::guard_value< T >::ref_.
|
private |
Definition at line 26 of file guard_value.hpp.
Referenced by utils::guard_value< T >::~guard_value().
|
private |
Definition at line 25 of file guard_value.hpp.
Referenced by utils::guard_value< T >::~guard_value().