49 template <
class Err = E>
56 constexpr const E &&
error() const &&noexcept {
return std::move(
m_error); }
68template <
class T,
class E = dberr_t>
78 : std::variant<T, E>(std::move(other)) {}
80 template <
class U, std::enable_if_t<
81 !std::is_same_v<std::decay_t<U>,
Expected>,
int> = 0>
83 : std::variant<T, E>(std::in_place_index<0>, std::forward<U>(u)) {}
87 :
std::variant<T, E>(
std::in_place_index<1>,
std::move(u).
error()) {}
94 return &std::get<0>(*
this);
99 return &std::get<0>(*
this);
104 return std::get<0>(*
this);
109 return std::get<0>(*
this);
114 return std::move(std::get<0>(*
this));
119 return std::move(std::get<0>(*
this));
122 constexpr explicit operator bool() const noexcept {
return has_value(); }
124 constexpr bool has_value() const noexcept {
return this->index() == 0; }
126 constexpr const T &
value() const & {
128 return std::get<0>(*
this);
133 return std::get<0>(*
this);
136 constexpr const T &&
value() const && {
138 return std::move(std::get<0>(*
this));
143 return std::move(std::get<0>(*
this));
146 constexpr const E &
error() const &noexcept {
148 return std::get<1>(*
this);
153 return std::get<1>(*
this);
156 constexpr const E &&
error() const &&noexcept {
158 return std::move(std::get<1>(*
this));
163 return std::move(std::get<1>(*
this));
C++23 std::expected.
Definition: ut0expected.h:69
constexpr Expected & operator=(Expected &&)=default
constexpr const T * operator->() const noexcept
Definition: ut0expected.h:92
constexpr T & value() &
Definition: ut0expected.h:131
constexpr Expected(U &&u) noexcept
Definition: ut0expected.h:82
constexpr const E & error() const &noexcept
Definition: ut0expected.h:146
E error_type
Definition: ut0expected.h:72
constexpr const E && error() const &&noexcept
Definition: ut0expected.h:156
T value_type
Definition: ut0expected.h:71
constexpr T & operator*() &noexcept
Definition: ut0expected.h:107
constexpr T && operator*() &&noexcept
Definition: ut0expected.h:117
constexpr const T && operator*() const &&noexcept
Definition: ut0expected.h:112
constexpr Expected(const Expected &other)=default
constexpr T * operator->() noexcept
Definition: ut0expected.h:97
constexpr Expected(Expected &&other) noexcept
Definition: ut0expected.h:77
constexpr Expected(Unexpected< U > &&u)
Definition: ut0expected.h:86
constexpr E && error() &&noexcept
Definition: ut0expected.h:161
constexpr const T & operator*() const &noexcept
Definition: ut0expected.h:102
constexpr E & error() &noexcept
Definition: ut0expected.h:151
constexpr T && value() &&
Definition: ut0expected.h:141
constexpr Expected & operator=(const Expected &)=default
constexpr const T && value() const &&
Definition: ut0expected.h:136
constexpr const T & value() const &
Definition: ut0expected.h:126
constexpr bool has_value() const noexcept
Definition: ut0expected.h:124
C++23 std::unexpected.
Definition: ut0expected.h:47
constexpr Unexpected(Err &&e)
Definition: ut0expected.h:50
constexpr E && error() &&noexcept
Definition: ut0expected.h:58
constexpr E & error() &noexcept
Definition: ut0expected.h:54
E m_error
Definition: ut0expected.h:61
constexpr const E && error() const &&noexcept
Definition: ut0expected.h:56
constexpr const E & error() const &noexcept
Definition: ut0expected.h:52
#define U
Definition: ctype-tis620.cc:74
Global error codes for the database.
Definition: gcs_xcom_synode.h:64
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
Unexpected(E) -> Unexpected< E >
Debug utilities for Innobase.
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93