E-MailRelay
|
A class template like a simplified c++17 std::optional. More...
#include <goptional.h>
Public Member Functions | |
optional () noexcept(noexcept(T())) | |
Default constructor for no value. | |
optional (const T &) | |
Constructor for a defined value. More... | |
optional (bool has_value, const T &value) | |
Constructor. Not in std::optional. More... | |
void | clear () |
Clears the value. Not in std::optional. More... | |
bool | has_value () const noexcept |
Returns true if a defined value. More... | |
operator bool () const noexcept | |
Returns true if a defined value. More... | |
const T & | value () const |
Returns the value. More... | |
T | value_or (const T &) const |
Returns the value or a default. More... | |
optional< T > & | operator= (const T &) |
Assignment for a defined value. More... | |
optional (const optional &)=default | |
optional (optional &&) noexcept=default | |
optional & | operator= (const optional &)=default |
optional & | operator= (optional &&) noexcept=default |
A class template like a simplified c++17 std::optional.
Definition at line 37 of file goptional.h.
|
explicit |
Constructor for a defined value.
Definition at line 87 of file goptional.h.
G::optional< T >::optional | ( | bool | has_value, |
const T & | value | ||
) |
Constructor. Not in std::optional.
Definition at line 94 of file goptional.h.
void G::optional< T >::clear |
Clears the value. Not in std::optional.
Definition at line 101 of file goptional.h.
|
noexcept |
Returns true if a defined value.
Definition at line 107 of file goptional.h.
|
explicitnoexcept |
Returns true if a defined value.
Definition at line 113 of file goptional.h.
G::optional< T > & G::optional< T >::operator= | ( | const T & | t | ) |
Assignment for a defined value.
Definition at line 138 of file goptional.h.
const T & G::optional< T >::value |
Returns the value.
Definition at line 119 of file goptional.h.
T G::optional< T >::value_or | ( | const T & | default_ | ) | const |
Returns the value or a default.
Definition at line 132 of file goptional.h.