4.4.0
|
|
Freundlich's C++ toolkit |
A class that makes values optional.
This class is a wrapper around std::optional
that makes the following changes:
operator->
and operator*
. This has been replaced get_unsafe
. operator bool()
. This has been replaced by has_value
. T
. Assign an optional instead. T | Must be move constructible. |
See fcppt.optional for more information.
Public Types | |
using | value_type = T |
The value type. | |
Public Member Functions | |
object () | |
Constructs an empty optional. | |
object (T const &) | |
Constructs an optional by copying. | |
object (T &&) | |
Constructs an optional by moving. | |
T & | get_unsafe () |
Returns a reference to the current value. | |
T const & | get_unsafe () const |
Returns a const reference to the current value. | |
bool | has_value () const |
Returns whether the optional holds a value. | |
using fcppt::optional::object< T >::value_type = T |
The value type.
fcppt::optional::object< T >::object | ( | ) |
Constructs an empty optional.
|
explicit |
Constructs an optional by copying.
|
explicit |
Constructs an optional by moving.
T & fcppt::optional::object< T >::get_unsafe | ( | ) |
Returns a reference to the current value.
has_value()
is false. T const & fcppt::optional::object< T >::get_unsafe | ( | ) | const |
Returns a const reference to the current value.
has_value()
is false. bool fcppt::optional::object< T >::has_value | ( | ) | const |
Returns whether the optional holds a value.