3.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 | The type to make optional, which must be CopyConstructible or Movable, Assignable or MoveAssignable and complete. It therefore must also not be const. |
See fcppt.optional for more information.
Public Types | |
using | value_type = T |
The value type. More... | |
Public Member Functions | |
object () | |
Constructs an empty optional. More... | |
object (T const &) | |
Constructs an optional by copying. More... | |
object (T &&) | |
Constructs an optional by moving. More... | |
T & | get_unsafe () |
Returns a reference to the current value. More... | |
const T & | get_unsafe () const |
Returns a const reference to the current value. More... | |
bool | has_value () const |
Returns whether the optional holds a value. More... | |
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 const T& 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.