4.6.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 | std_type = std::optional<T> |
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. | |
std_type & | impl () |
std_type const & | impl () const |
using fcppt::optional::object< T >::std_type = std::optional<T> |
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.
|
nodiscard |
Returns a reference to the current value.
has_value()
is false.
|
nodiscard |
Returns a const reference to the current value.
has_value()
is false.
|
nodiscard |
Returns whether the optional holds a value.
|
nodiscard |
|
nodiscard |