22#if defined(__has_include)
23#if __has_include(<version>)
29#if defined(__cpp_lib_expected) && __cpp_lib_expected >= 202211L
35template <
typename T,
typename E>
36using expected = std::expected<T, E>;
72template <
typename T,
typename E>
class expected;
82template <
typename T,
typename E>
class expected {
145 template <
typename U>
151 template <
typename U,
152 typename = std::enable_if_t<!std::is_same_v<U, T> &&
153 std::is_convertible_v<U, T>>>
constexpr bool has_value() const noexcept
Definition tle92466ed_expected.hpp:195
constexpr expected(unexpected< E > &&u) noexcept
Definition tle92466ed_expected.hpp:180
constexpr expected(const expected &) noexcept=default
constexpr E & error() &noexcept
Definition tle92466ed_expected.hpp:199
E error_
Definition tle92466ed_expected.hpp:168
constexpr expected() noexcept
Definition tle92466ed_expected.hpp:173
constexpr expected(const unexpected< E > &u) noexcept
Definition tle92466ed_expected.hpp:176
constexpr E && error() &&noexcept
Definition tle92466ed_expected.hpp:201
bool has_value_
Definition tle92466ed_expected.hpp:169
constexpr expected(expected &&) noexcept=default
constexpr const E & error() const &noexcept
Definition tle92466ed_expected.hpp:200
Expected type — holds either a value of type T or an error of type E.
Definition tle92466ed_expected.hpp:82
constexpr T && operator*() &&noexcept
Definition tle92466ed_expected.hpp:135
constexpr T && value() &&noexcept
Definition tle92466ed_expected.hpp:121
constexpr const T & operator*() const &noexcept
Definition tle92466ed_expected.hpp:132
constexpr T & value() &noexcept
Definition tle92466ed_expected.hpp:119
constexpr const E & error() const &noexcept
Definition tle92466ed_expected.hpp:126
bool has_value_
Definition tle92466ed_expected.hpp:85
constexpr bool has_value() const noexcept
Definition tle92466ed_expected.hpp:115
constexpr T value_or(U &&default_val) const &noexcept
Definition tle92466ed_expected.hpp:146
constexpr expected(const expected &) noexcept=default
constexpr expected(const T &v) noexcept
Definition tle92466ed_expected.hpp:89
constexpr expected(expected &&) noexcept=default
constexpr T & operator*() &noexcept
Definition tle92466ed_expected.hpp:131
constexpr T * operator->() noexcept
Definition tle92466ed_expected.hpp:139
constexpr expected(const expected< U, E > &other) noexcept
Definition tle92466ed_expected.hpp:154
constexpr expected(unexpected< E > &&u) noexcept
Definition tle92466ed_expected.hpp:100
E error_
Definition tle92466ed_expected.hpp:84
T value_
Definition tle92466ed_expected.hpp:83
constexpr expected(T &&v) noexcept
Definition tle92466ed_expected.hpp:92
constexpr const T * operator->() const noexcept
Definition tle92466ed_expected.hpp:140
constexpr E & error() &noexcept
Definition tle92466ed_expected.hpp:125
constexpr E && error() &&noexcept
Definition tle92466ed_expected.hpp:127
constexpr const T & value() const &noexcept
Definition tle92466ed_expected.hpp:120
constexpr expected(const unexpected< E > &u) noexcept
Definition tle92466ed_expected.hpp:96
Wrapper for an error value (mirrors std::unexpected)
Definition tle92466ed_expected.hpp:56
constexpr unexpected(const E &e) noexcept
Definition tle92466ed_expected.hpp:60
constexpr E & error() &noexcept
Definition tle92466ed_expected.hpp:64
constexpr E && error() &&noexcept
Definition tle92466ed_expected.hpp:65
constexpr unexpected(E &&e) noexcept
Definition tle92466ed_expected.hpp:61
E error_
Definition tle92466ed_expected.hpp:57
constexpr const E & error() const &noexcept
Definition tle92466ed_expected.hpp:63
Definition tle92466ed_expected.hpp:50
unexpected(E) -> unexpected< E >
Deduction guide.