PLaSK library
Loading...
Searching...
No Matches
plask::AssignWithBackup< T > Struct Template Reference

Assign new value to variable and back the old value in destructor. More...

#include <plask/utils/stl.hpp>

Collaboration diagram for plask::AssignWithBackup< T >:
[legend]

Public Member Functions

template<typename... ConstructorArgsT>
 AssignWithBackup (T &varible_to_back, ConstructorArgsT &&... newValueCtrArgs)
 
 ~AssignWithBackup ()
 

Public Attributes

T & original
 
store
 

Detailed Description

template<typename T>
struct plask::AssignWithBackup< T >

Assign new value to variable and back the old value in destructor.

It:

  1. constructs new value using given constructor parameters
  2. swaps values of given variable and constructed one
  3. in destructor: swaps the values back

Definition at line 111 of file stl.hpp.

Constructor & Destructor Documentation

◆ AssignWithBackup()

template<typename T >
template<typename... ConstructorArgsT>
plask::AssignWithBackup< T >::AssignWithBackup ( T &  varible_to_back,
ConstructorArgsT &&...  newValueCtrArgs 
)
inline

Definition at line 116 of file stl.hpp.

◆ ~AssignWithBackup()

template<typename T >
plask::AssignWithBackup< T >::~AssignWithBackup ( )
inline

Definition at line 121 of file stl.hpp.

Member Data Documentation

◆ original

template<typename T >
T& plask::AssignWithBackup< T >::original

Definition at line 112 of file stl.hpp.

◆ store

template<typename T >
T plask::AssignWithBackup< T >::store

Definition at line 113 of file stl.hpp.


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