18 bool delivered{
false};
21 constexpr LetBase()
noexcept =
default;
22 LetBase(
const LetBase& copy) =
default;
23 LetBase(LetBase&& other)
noexcept =
default;
24 LetBase& operator=(
const LetBase& copy) =
default;
25 LetBase& operator=(LetBase&& other)
noexcept =
default;
28 void reset() noexcept { delivered =
false; }
29 [[nodiscard]]
constexpr bool has_result() const noexcept {
return this->delivered; }
40 using block_t = std::function<T()>;
41 std::optional<T> result;
48 explicit Let(block_t body) noexcept : LetBase(), body(body) {}
51 return std::addressof(value());
54 T& operator*() & {
return value(); }
74 return result.value();
Base class for lets to abstract away the template arguments.
Definition let.hpp:16
virtual ~LetBase()=default
Virtual, as a Description owns its lets through std::unique_ptr<LetBase>.