Audacity 3.2.0
|
RAII guard for temporary installation of a value; movable. More...
#include <GlobalVariable.h>
Public Member Functions | |
Scope (mutable_type value) | |
Scope (Scope &&other)=default | |
Scope & | operator= (Scope &&other)=default |
~Scope () | |
void | Commit () |
bool | HasValue () const |
Private Attributes | |
std::conditional_t< ScopedOnly, mutable_type, std::optional< mutable_type > > | m_previous |
RAII guard for temporary installation of a value; movable.
Constructor captures previous value, installs a new value; destructor restores the previous value, unless moved-from or Commit
ted
Not required to have stack-like lifetime. Non-nested lifetimes for distinct Scope objects is not prevented and may have surprising results.
Definition at line 70 of file GlobalVariable.h.
|
inlineexplicit |
Definition at line 73 of file GlobalVariable.h.
|
default |
|
inline |
Definition at line 78 of file GlobalVariable.h.
References GlobalVariable< Tag, Type, initializer, ScopedOnly >::Assign(), and GlobalVariable< Tag, Type, initializer, ScopedOnly >::Scope::m_previous.
|
inline |
Won't compile unless ScopedOnly is false
Definition at line 86 of file GlobalVariable.h.
References GlobalVariable< Tag, Type, initializer, ScopedOnly >::Scope::m_previous.
|
inline |
Definition at line 91 of file GlobalVariable.h.
References GlobalVariable< Tag, Type, initializer, ScopedOnly >::Scope::m_previous.
|
default |
|
private |