This class template manages an optional contained value, i.e. More...
#include <optional.hpp>
Public Types | |
| using | type = T |
Public Member Functions | |
| optional ()=default | |
| Default constructor. More... | |
| optional (const T &val) noexcept | |
| Copy constructor from an instance of the templated class. More... | |
| optional (T &&val) noexcept | |
| Move constructor from an instance of the templated class. More... | |
| optional (const optional< T > &val) noexcept | |
| Copy constructor. More... | |
| optional (optional< T > &&val) noexcept | |
| Move constructor. More... | |
| ~optional ()=default | |
| Destructor. More... | |
| template<class ... Args> | |
| void | emplace (Args &&... _args) |
| Constructs the contained value in-place. More... | |
| void | reset (bool initial_engaged=false) |
| Reset the state of the optional. More... | |
| T & | value () & |
| Returns the contained value. More... | |
| const T & | value () const & |
| Returns the contained value. More... | |
| T && | value () && |
| Returns the contained value. More... | |
| const T && | value () const && |
| Returns the contained value. More... | |
| bool | has_value () const |
| Checks whether the optional contains a value. More... | |
| optional & | operator= (const optional &opt) |
| Assigns content from an optional. More... | |
| optional & | operator= (optional &&opt) |
| Assigns content from an optional. More... | |
| optional & | operator= (const T &val) |
| Assigns content from an instance of the templated class. More... | |
| optional & | operator= (T &&val) |
| Assigns content from an instance of the templated class. More... | |
| optional & | operator= (nullopt_t) noexcept |
| Uninitialized the optional. More... | |
| bool | operator== (const optional &opt_val) const |
| Compares optional values. More... | |
| bool | operator!= (const optional &opt_val) const |
| Compares optional values. More... | |
| T & | operator* () &noexcept |
| Accesses the contained value. More... | |
| const T & | operator* () const &noexcept |
| Accesses the contained value. More... | |
| T && | operator* () &&noexcept |
| Accesses the contained value. More... | |
| const T && | operator* () const &&noexcept |
| Accesses the contained value. More... | |
| T * | operator-> () noexcept |
| Accesses the contained value. More... | |
| const T * | operator-> () const noexcept |
| Accesses the contained value. More... | |
| operator bool () const noexcept | |
| Checks whether the optional contains a value. More... | |
This class template manages an optional contained value, i.e.
a value that may or may not be present.
| using type = T |
|
default |
Default constructor.
|
inlinenoexcept |
Copy constructor from an instance of the templated class.
|
inlinenoexcept |
Move constructor from an instance of the templated class.
|
default |
Destructor.
|
inline |
Constructs the contained value in-place.
| [in] | _args | The arguments to pass to the constructor. |
|
inline |
Checks whether the optional contains a value.
|
inlineexplicitnoexcept |
Checks whether the optional contains a value.
|
inline |
Compares optional values.
|
inlinenoexcept |
Accesses the contained value.
The behavior is undefined if *this does not contain a value.
|
inlinenoexcept |
Accesses the contained value.
The behavior is undefined if *this does not contain a value.
|
inlinenoexcept |
Accesses the contained value.
The behavior is undefined if *this does not contain a value.
|
inlinenoexcept |
Accesses the contained value.
The behavior is undefined if *this does not contain a value.
|
inlinenoexcept |
Accesses the contained value.
The behavior is undefined if *this does not contain a value.
|
inlinenoexcept |
Accesses the contained value.
The behavior is undefined if *this does not contain a value.
|
inline |
Assigns content from an instance of the templated class.
|
inline |
Assigns content from an instance of the templated class.
|
inline |
Compares optional values.
|
inline |
Reset the state of the optional.
| [in] | initial_engaged | True value initializes the state with a default instance of the templated class. False value leaves the optional in a uninitialized state. |
|
inline |
Returns the contained value.
| exception::BadOptionalAccessException | This exception is thrown when the optional is uninitialized. |
|
inline |
Returns the contained value.
| exception::BadOptionalAccessException | This exception is thrown when the optional is uninitialized. |
|
inline |
Returns the contained value.
| exception::BadOptionalAccessException | This exception is thrown when the optional is uninitialized. |
|
inline |
Returns the contained value.
| exception::BadOptionalAccessException | This exception is thrown when the optional is uninitialized. |