* }
*/
#include <cstddef>
+#include <new>
#include <stdexcept>
#include <type_traits>
#include <utility>
return storage_.value;
}
+ // TODO: This should return Value&& instead of Value. Like with
+ // std::move, the calling code should decide whether it wants the move
+ // to happen or not. See std::optional.
Value value() && {
require_value();
return std::move(storage_.value);
const Value& operator*() const& { return value(); }
Value& operator*() & { return value(); }
+ // TODO: This should return Value&& instead of Value. Like with
+ // std::move, the calling code should decide whether it wants the move
+ // to happen or not. See std::optional.
Value operator*() && { return std::move(value()); }
const Value* operator->() const { return &value(); }