27 bool _has_value =
false;
53 return _has_value && rhs.
has_value() ? (_value == rhs.
value()) :
false;
57 explicit operator bool()
const {
A simple and naiive implementation of an optional value.
optional()
Construct without a contained value.
optional< T > & operator=(const T &v)
Assign a non-optional value of type T.
void reset()
Mark the optional as not containing a valid value.
optional(T v)
Construct with a contained value.
T value() const
Access the contained value.
bool has_value() const
Test if a value is contained.
bool operator==(const optional< T > &rhs) const
Compare with another optional of the same type T.