5#ifndef BITCOIN_UTIL_EXPECTED_H
6#define BITCOIN_UTIL_EXPECTED_H
35 const char*
what() const noexcept
override {
return "Bad util::Expected access"; }
43template <
class T,
class E>
58 constexpr explicit operator bool() const noexcept {
return has_value(); }
65 return std::get<0>(
m_data);
72 return std::get<0>(
m_data);
84 return has_value() ? std::move(
value()) : std::forward<U>(default_value);
115 constexpr explicit operator bool() const noexcept {
return has_value(); }
#define Assert(val)
Identity function.
constexpr bool has_value() const noexcept
constexpr void value() const
constexpr Expected(Unexpected< Err > u)
std::variant< std::monostate, E > m_data
constexpr const E & error() const &noexcept LIFETIMEBOUND
constexpr void operator*() const noexcept
constexpr E & error() &noexcept LIFETIMEBOUND
constexpr E && error() &&noexcept LIFETIMEBOUND
The util::Expected class provides a standard way for low-level functions to return either error value...
constexpr T & operator*() &noexcept LIFETIMEBOUND
T value_or(U &&default_value) const &
constexpr const T * operator->() const noexcept LIFETIMEBOUND
constexpr E && error() &&noexcept LIFETIMEBOUND
constexpr E & error() &noexcept LIFETIMEBOUND
T value_or(U &&default_value) &&
std::variant< T, E > m_data
constexpr T & value() &LIFETIMEBOUND
constexpr const T & operator*() const &noexcept LIFETIMEBOUND
constexpr T * operator->() noexcept LIFETIMEBOUND
constexpr bool has_value() const noexcept
constexpr T && value() &&LIFETIMEBOUND
constexpr const T & value() const &LIFETIMEBOUND
constexpr Expected(Unexpected< Err > u)
constexpr const E & error() const &noexcept LIFETIMEBOUND
constexpr T && operator*() &&noexcept LIFETIMEBOUND
constexpr void swap(Expected &other) noexcept
The util::Unexpected class represents an unexpected value stored in util::Expected.
constexpr E & error() &noexcept LIFETIMEBOUND
constexpr const E & error() const &noexcept LIFETIMEBOUND
constexpr E && error() &&noexcept LIFETIMEBOUND
constexpr Unexpected(E e)
#define T(expected, seed, data)
const char * what() const noexcept override