Kanzi  3.9.6
Kanzi Engine API
kanzi::ScopeValue< Type > Class Template Reference

ScopeValue template class sets a value to a variable of Type for the lifetime of the ScopeValue object, and restores the previous value of the variable when destroyed. More...

#include <kanzi/core/util/scope_value.hpp>

Public Member Functions

 ScopeValue (Type &variable, const Type &value)
 Constructor, backs up the value of the variable and sets the value as current value. More...
 
 ~ScopeValue ()
 Destructor, restores the value of the scoped variable. More...
 

Detailed Description

template<typename Type>
class kanzi::ScopeValue< Type >

ScopeValue template class sets a value to a variable of Type for the lifetime of the ScopeValue object, and restores the previous value of the variable when destroyed.

Template Parameters
TypeThe type of the variable and the value to assign to the variable.
Since
Kanzi 3.9.0

Constructor & Destructor Documentation

◆ ScopeValue()

template<typename Type >
kanzi::ScopeValue< Type >::ScopeValue ( Type &  variable,
const Type &  value 
)
inlineexplicit

Constructor, backs up the value of the variable and sets the value as current value.

◆ ~ScopeValue()

template<typename Type >
kanzi::ScopeValue< Type >::~ScopeValue ( )
inline

Destructor, restores the value of the scoped variable.


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