#include <mn_optional.hpp>
Public Types | |
using | value_type = T |
using | const_value_type = const T |
using | reference = T & |
using | const_reference = const T & |
using | move_type = T && |
using | const_move_type = const T && |
using | pointer = T * |
using | const_pointer = const T * |
using | self_type = basic_optional< T > |
Public Member Functions | |
constexpr | basic_optional () noexcept |
basic_optional (const self_type &other) | |
basic_optional (const self_type &&other) noexcept | |
template<typename... Args> | |
constexpr | basic_optional (Args &&... args) |
template<typename U = value_type> | |
constexpr | basic_optional (U &&value) |
~basic_optional () | |
void | reset () noexcept |
Resets the basic_optional. More... | |
void | clear () |
Clears the basic_optional. More... | |
self_type & | assign (const_value_type &value) |
Assigns a value to the basic_otional. More... | |
self_type & | assign (move_type value) |
Moves a value into the basic_otional. More... | |
self_type & | assign (const self_type &other) |
Assigns another basic_otional. More... | |
void | swap (self_type &other) |
Swap this basic_optional with a other. More... | |
constexpr bool | has_value () const noexcept |
Have this basic_optional a value? More... | |
reference | value () |
Returns the basic_optional's value. More... | |
const_reference | value () const |
Returns the basic_optional's value. More... | |
constexpr value_type | value_or (const value_type value) const |
Returns the basic_optional's value, or the given default value when this basic_optional no value have. More... | |
template<typename U > | |
constexpr value_type | value_or (const U &value) const |
Returns the basic_optional's value, or the given default value when this basic_optional no value have. More... | |
self_type & | operator= (const self_type &other) noexcept |
Assigns another basic_otional. More... | |
self_type & | operator= (self_type &&other) noexcept |
Assigns another basic_otional. More... | |
constexpr const_pointer | operator-> () const |
Get the given value as pointer. More... | |
pointer | operator-> () |
constexpr const_reference | operator* () const |
reference | operator* () |
operator bool () const noexcept | |
Convert this basic_optional to boolean. More... | |
Private Attributes | |
bool | m_bHasValue |
Flag whether or not has this basic_optianel a value. More... | |
value_type | m_tValue |
A saved / cached copy of the value. More... | |
Member Typedef Documentation
◆ const_move_type
using mn::basic_optional< T >::const_move_type = const T&& |
◆ const_pointer
using mn::basic_optional< T >::const_pointer = const T* |
◆ const_reference
using mn::basic_optional< T >::const_reference = const T& |
◆ const_value_type
using mn::basic_optional< T >::const_value_type = const T |
◆ move_type
using mn::basic_optional< T >::move_type = T&& |
◆ pointer
using mn::basic_optional< T >::pointer = T* |
◆ reference
using mn::basic_optional< T >::reference = T& |
◆ self_type
using mn::basic_optional< T >::self_type = basic_optional<T> |
◆ value_type
using mn::basic_optional< T >::value_type = T |
Constructor & Destructor Documentation
◆ basic_optional() [1/5]
|
inlineconstexprnoexcept |
◆ basic_optional() [2/5]
|
inline |
◆ basic_optional() [3/5]
|
inlinenoexcept |
◆ basic_optional() [4/5]
|
inlineexplicitconstexpr |
◆ basic_optional() [5/5]
|
inlineexplicitconstexpr |
◆ ~basic_optional()
|
inline |
Member Function Documentation
◆ assign() [1/3]
|
inline |
Assigns another basic_otional.
◆ assign() [2/3]
|
inline |
Assigns a value to the basic_otional.
◆ assign() [3/3]
|
inline |
Moves a value into the basic_otional.
◆ clear()
|
inline |
Clears the basic_optional.
◆ has_value()
|
inlineconstexprnoexcept |
Have this basic_optional a value?
- Returns
- True when this basic_optional hald any vaule and false when not.
◆ operator bool()
|
inlineexplicitnoexcept |
Convert this basic_optional to boolean.
- Returns
- True when this basic_optional hald any vaule and false when not.
◆ operator*() [1/2]
|
inline |
◆ operator*() [2/2]
|
inlineconstexpr |
◆ operator->() [1/2]
|
inline |
◆ operator->() [2/2]
|
inlineconstexpr |
Get the given value as pointer.
◆ operator=() [1/2]
|
inlinenoexcept |
Assigns another basic_otional.
◆ operator=() [2/2]
|
inlinenoexcept |
Assigns another basic_otional.
◆ reset()
|
inlinenoexcept |
Resets the basic_optional.
◆ swap()
|
inline |
Swap this basic_optional with a other.
◆ value() [1/2]
|
inline |
Returns the basic_optional's value.
◆ value() [2/2]
|
inline |
Returns the basic_optional's value.
◆ value_or() [1/2]
|
inlineconstexpr |
Returns the basic_optional's value, or the given default value when this basic_optional no value have.
◆ value_or() [2/2]
|
inlineconstexpr |
Returns the basic_optional's value, or the given default value when this basic_optional no value have.
Member Data Documentation
◆ m_bHasValue
|
private |
Flag whether or not has this basic_optianel a value.
◆ m_tValue
|
private |
A saved / cached copy of the value.
The documentation for this class was generated from the following file: