Audacity
3.2.0
|
Like a smart pointer, allows for object to not exist (nullptr) More...
#include <MemoryX.h>
Public Types | |
using | value_type = X |
Public Member Functions | |
Optional () | |
Optional (const Optional &that) | |
Optional & | operator= (const Optional &that) |
Optional (Optional &&that) | |
Optional & | operator= (Optional &&that) |
template<typename... Args> | |
X & | emplace (Args &&... args) |
~Optional () | |
X & | operator* () const |
Dereference, with the usual bad consequences if NULL. More... | |
X * | operator-> () const |
void | reset () |
operator bool () const | |
bool | has_value () const |
Private Member Functions | |
X * | address () |
Private Attributes | |
union { | |
double d | |
char storage [sizeof(X)] | |
}; | |
X * | pp { nullptr } |
Like a smart pointer, allows for object to not exist (nullptr)
emulating some of std::optional of C++17
template class Optional<X> Can be used for monomorphic objects that are stack-allocable, but only conditionally constructed. You might also use it as a member. Initialize with emplace(), then use like a smart pointer, with *, ->, reset(), or in if()
using Optional< X >::value_type = X |
|
inlineprivate |
Definition at line 239 of file MemoryX.h.
Referenced by Optional< CommandSignature >::emplace().
|
inline |
Make an object in the buffer, passing constructor arguments, but destroying any previous object first Note that if constructor throws, we remain in a consistent NULL state – giving exception safety but only weakly (previous value was lost if present)
Definition at line 193 of file MemoryX.h.
Referenced by ProjectFileManager::DoSave(), OverlayPanel::DrawOverlays(), OldStyleCommandType::GetSignature(), Optional< CommandSignature >::operator=(), Optional< CommandSignature >::Optional(), EffectFindClipping::Process(), NyquistEffect::Process(), FrequencyPlotDialog::Recalc(), and ShuttleGuiBase::StartRadioButtonGroup().
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Definition at line 221 of file MemoryX.h.
Referenced by Optional< CommandSignature >::emplace(), ShuttleGuiBase::EndRadioButtonGroup(), Optional< CommandSignature >::operator=(), and Optional< CommandSignature >::~Optional().
union { ... } |
|
private |
Definition at line 256 of file MemoryX.h.
Referenced by Optional< CommandSignature >::emplace(), Optional< CommandSignature >::has_value(), Optional< CommandSignature >::operator bool(), Optional< CommandSignature >::operator*(), Optional< CommandSignature >::operator->(), and Optional< CommandSignature >::reset().
char Optional< X >::storage[sizeof(X)] |
Definition at line 253 of file MemoryX.h.
Referenced by Optional< CommandSignature >::address().