40 std::exception_ptr GetException()
const noexcept;
44 std::optional<T> value_;
45 std::exception_ptr exception_;
52class ResultStore<
void>
final {
67 std::exception_ptr GetException()
const noexcept;
70 bool has_value_{
false};
71 std::exception_ptr exception_;
77 return std::move(*value_);
80 std::rethrow_exception(exception_);
82 throw std::logic_error(
"result store is not ready");
86const T& ResultStore<T>::
Get()
const& {
91 std::rethrow_exception(exception_);
93 throw std::logic_error(
"result store is not ready");
103 value_.emplace(std::move(value));
107void ResultStore<T>::
SetException(std::exception_ptr&& exception)
noexcept {
108 exception_ = std::move(exception);
112std::exception_ptr ResultStore<T>::GetException()
const noexcept {
117inline void ResultStore<
void>::
Retrieve() { Get(); }
119inline void ResultStore<
void>::Get()
const& {
124 std::rethrow_exception(exception_);
126 throw std::logic_error(
"result store is not ready");
129inline void ResultStore<
void>::
SetValue()
noexcept { has_value_ =
true; }
131inline void ResultStore<
void>::
SetException(std::exception_ptr&& exception)
noexcept {
132 exception_ = std::move(exception);
135inline std::exception_ptr ResultStore<
void>::GetException()
const noexcept {
return exception_; }