The Battle for Wesnoth  1.15.3+dev
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 85 of file utility.hpp.

Constructor & Destructor Documentation

◆ variable_finalizer()

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

Definition at line 88 of file utility.hpp.

◆ ~variable_finalizer()

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

Definition at line 92 of file utility.hpp.

Member Function Documentation

◆ clear()

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 99 of file utility.hpp.

Member Data Documentation

◆ value_

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

Definition at line 105 of file utility.hpp.

◆ variable_

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

Definition at line 104 of file utility.hpp.


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