The Conley-Morse Graphs Software
|
Initializes the given variable with the value provided and restores the previous value at the end of the current block. More...
#include <utils.h>
Public Member Functions | |
local_value (T &_variable, const T &_value) | |
The only allowed constructor. More... | |
~local_value () | |
The destructor which restores the original value of the variable. More... | |
Private Attributes | |
T & | variable |
A reference of the variable. More... | |
T | previous_value |
The original value of the variable. More... | |
Initializes the given variable with the value provided and restores the previous value at the end of the current block.
The restoration of the previous value takes place upon destruction of this object. This action effects in a local value of a given variable valid in the current block only (e.g., until 'return').
|
inline |
The only allowed constructor.
Definition at line 112 of file utils.h.
References local_value< T >::variable.
|
inline |
The destructor which restores the original value of the variable.
Definition at line 117 of file utils.h.
References local_value< T >::previous_value, and local_value< T >::variable.
|
private |
The original value of the variable.
Definition at line 124 of file utils.h.
Referenced by local_value< T >::~local_value().
|
private |
A reference of the variable.
Definition at line 121 of file utils.h.
Referenced by local_value< T >::local_value(), and local_value< T >::~local_value().