Calico
|
Represents an optional value. More...
#include <optional.hpp>
Public Member Functions | |
optional () | |
Creates a disengaged optional value. | |
optional (nullopt_t) | |
Creates a disengaged optional value. | |
optional (const T &value) | |
Creates an engaged optional value. | |
operator bool () const | |
Returns whether the optional is engaged. | |
optional & | operator= (nullopt_t) |
Disengages the value from the optional . | |
template<class U > | |
optional & | operator= (const U &value) |
Assigns a value to the optional . | |
const T & | value () const |
Extracts the value from the optional . If there is none, an std::logic_error is thrown. | |
T & | value () |
Extracts the value from the optional . If there is none, an std::logic_error is thrown. | |
template<class U > | |
T | value_or (const U &value) const |
Returns the value of the optional if it exists, or the given value argument otherwise. | |
Represents an optional value.