5 #ifndef BITCOIN_UTIL_RESULT_H 6 #define BITCOIN_UTIL_RESULT_H 38 using T = std::conditional_t<std::is_same_v<M, void>, std::monostate,
M>;
52 template <
typename FT>
83 return has_value() ? std::move(
value()) : std::forward<U>(default_value);
85 explicit operator bool() const noexcept {
return has_value(); }
99 #endif // BITCOIN_UTIL_RESULT_H
T & value() LIFETIMEBOUND
const T & operator*() const LIFETIMEBOUND
std::conditional_t< std::is_same_v< void, void >, std::monostate, void > T
std::variant< bilingual_str, T > m_variant
const T & value() const LIFETIMEBOUND
bool has_value() const noexcept
std::optional methods, so functions returning optional<T> can change to return Result<T> with minimal...
const T * operator->() const LIFETIMEBOUND
T value_or(U &&default_value) const &
friend bilingual_str ErrorString(const Result< FT > &result)
T * operator->() LIFETIMEBOUND
Result & operator=(const Result &)=delete
Disallow operator= to avoid confusion in the future when the Result class gains support for richer er...
T & operator*() LIFETIMEBOUND
T value_or(U &&default_value) &&
bilingual_str ErrorString(const Result< T > &result)