The Battle for Wesnoth  1.19.7+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 89 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 92 of file utility.hpp.

◆ ~variable_finalizer()

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

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

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

Member Data Documentation

◆ value_

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

Definition at line 109 of file utility.hpp.

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

◆ variable_

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

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