The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
wb::variable_finalizer< T > Class Template Reference

Finalizer class to help with exception safety sets variable to value on destruction. More...

#include <utility.hpp>

Public Member Functions

 variable_finalizer (T &variable, T value)
 
 ~variable_finalizer ()
 
void clear ()
 Stop tracking the variable, i.e. More...
 

Private Attributes

T * variable_
 
value_
 

Detailed Description

template<typename T>
class wb::variable_finalizer< T >

Finalizer class to help with exception safety sets variable to value on destruction.

Definition at line 81 of file utility.hpp.

Constructor & Destructor Documentation

template<typename T>
wb::variable_finalizer< T >::variable_finalizer ( T &  variable,
value 
)
inline

Definition at line 84 of file utility.hpp.

template<typename T>
wb::variable_finalizer< T >::~variable_finalizer ( )
inline

Member Function Documentation

template<typename T>
void wb::variable_finalizer< T >::clear ( )
inline

Stop tracking the variable, i.e.

this object won't do anything on destruction.

Definition at line 95 of file utility.hpp.

References wb::variable_finalizer< T >::variable_.

Member Data Documentation

template<typename T>
T wb::variable_finalizer< T >::value_
private

Definition at line 101 of file utility.hpp.

Referenced by wb::variable_finalizer< T >::~variable_finalizer().

template<typename T>
T* wb::variable_finalizer< T >::variable_
private

The documentation for this class was generated from the following file: