20 #ifndef RIPPLE_BASICS_EXPECTED_H_INCLUDED
21 #define RIPPLE_BASICS_EXPECTED_H_INCLUDED
23 #include <ripple/basics/contract.h>
24 #include <boost/outcome.hpp>
54 if (!base::_has_value(std::forward<Impl>(
self)))
55 Throw<bad_expected_access>();
62 if (!base::_has_error(std::forward<Impl>(
self)))
63 Throw<bad_expected_access>();
70 if (!base::_has_exception(std::forward<Impl>(
self)))
71 Throw<bad_expected_access>();
110 return std::move(
val_);
116 return std::move(
val_);
124 template <
typename E, std::
size_t N>
128 template <
class T,
class E>
130 :
private boost::outcome_v2::result<T, E, detail::throw_policy>
132 using Base = boost::outcome_v2::result<T, E, detail::throw_policy>;
151 return Base::has_value();
156 return Base::value();
161 return Base::value();
166 return Base::error();
171 return Base::error();
174 constexpr
explicit operator bool()
const
184 return this->value();
189 return this->value();
194 return &this->value();
199 return &this->value();
207 :
private boost::outcome_v2::result<void, E, detail::throw_policy>
209 using Base = boost::outcome_v2::result<void, E, detail::throw_policy>;
227 return Base::error();
232 return Base::error();
235 constexpr
explicit operator bool()
const
237 return Base::has_value();
243 #endif // RIPPLE_BASICS_EXPECTED_H_INCLUDED