local_value< T > Class Template Reference

Initializes the given variable with the value provided and restores the previous value at the end of the current block. More...

#include <utils.h>

List of all members.

Public Member Functions

 local_value (T &_variable, const T &_value)
 The only allowed constructor.
 ~local_value ()
 The destructor which restores the original value of the variable.

Private Attributes

T & variable
 A reference of the variable.
previous_value
 The original value of the variable.


Detailed Description

template<class T>
class local_value< T >

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').

Definition at line 79 of file utils.h.


Constructor & Destructor Documentation

template<class T>
local_value< T >::local_value ( T &  _variable,
const T &  _value 
) [inline]

The only allowed constructor.

Definition at line 83 of file utils.h.

References local_value< T >::variable.

template<class T>
local_value< T >::~local_value (  )  [inline]

The destructor which restores the original value of the variable.

Definition at line 88 of file utils.h.

References local_value< T >::previous_value, and local_value< T >::variable.


Member Data Documentation

template<class T>
T& local_value< T >::variable [private]

A reference of the variable.

Definition at line 92 of file utils.h.

Referenced by local_value< T >::local_value(), and local_value< T >::~local_value().

template<class T>
T local_value< T >::previous_value [private]

The original value of the variable.

Definition at line 95 of file utils.h.

Referenced by local_value< T >::~local_value().


The documentation for this class was generated from the following file:
Generated on Sun Mar 28 17:47:58 2010 for The Conley-Morse Graphs Software by  doxygen 1.5.3