46 concepts::detail::ExpectedCanConvertConstructor<T, void, U, void>)
55 template<
typename U = T>
60 template<
typename... Args>
64 template<
typename U,
typename... Args>
67 : m_value(list,
util::forward<Args>(args)...) {}
82 template<
typename U = T>
85 m_value = util::forward<U>(
value);
89 constexpr auto operator->() {
return util::addressof(m_value.value()); }
90 constexpr auto operator->()
const {
return util::addressof(m_value.value()); }
92 constexpr auto operator*() & -> T& {
return m_value.value(); }
93 constexpr auto operator*() const& -> T const& {
return m_value.value(); }
94 constexpr auto operator*() && -> T&& {
return util::move(m_value).value(); }
95 constexpr auto operator*() const&& -> T const&& {
return util::move(m_value).value(); }
97 constexpr explicit operator bool()
const {
return true; }
98 constexpr auto has_value() const ->
bool {
return true; }
100 constexpr auto value() & -> T& {
return m_value.value(); }
101 constexpr auto value() const& -> T const& {
return m_value.value(); }
102 constexpr auto value() && -> T&& {
return util::move(m_value).value(); }
103 constexpr auto value() const&& -> T const&& {
return util::move(m_value).value(); }
108 template<concepts::ConvertibleTo<T> U>
114 template<concepts::ConvertibleTo<T> U>
117 return *util::move(*
this);
122 template<
typename... Args>
124 constexpr auto emplace(Args&&... args) -> T& {
125 return m_value.emplace(util::forward<Args>(args)...);
128 template<
typename U,
typename... Args>
130 constexpr auto emplace(std::initializer_list<U> list, Args&&... args) -> T& {
131 return m_value.emplace(list, util::forward<Args>(args)...);
139 template<
typename U,
typename G>
148 template<concepts::EqualityComparableWith<T> U,
typename G>
150 return b.has_value() && *a == *b;
155 constexpr friend auto operator==(
Expected const& a, U
const& b) ->
bool {
156 return a.value() == b;
164 template<concepts::RemoveCVRefSameAs<Expected> Self,
typename F,
165 typename U = meta::UnwrapRefDecay<meta::InvokeResult<F, meta::Like<Self, T>>>>
177 template<concepts::RemoveCVRefSameAs<Expected> Self,
typename F,
178 typename R = meta::InvokeResult<F, meta::Like<Self, T>>>
184 template<concepts::RemoveCVRefSameAs<Expected> Self,
typename F>
187 return util::forward<Self>(self);
190 template<concepts::RemoveCVRefSameAs<Expected> Self,
typename F>
193 return util::forward<Self>(self);
Definition monad_interface.h:15
Definition rebindable_box.h:42
constexpr auto operator=(Expected &&) -> Expected &requires(concepts::MoveConstructible< T >)=default
constexpr friend auto tag_invoke(types::Tag< function::monad::fmap_right >, Self &&self, F &&) -> Expected
Definition expected_void_error.h:192
constexpr auto emplace(Args &&... args) -> T &
Definition expected_void_error.h:124
constexpr auto value() const &&-> T const &&
Definition expected_void_error.h:103
constexpr friend void tag_invoke(types::Tag< util::swap >, Expected &a, Expected &b)
Definition expected_void_error.h:142
friend class Expected
Definition expected_void_error.h:140
constexpr void error() &&
Definition expected_void_error.h:106
constexpr auto operator*() const &&-> T const &&
Definition expected_void_error.h:95
constexpr auto emplace(std::initializer_list< U > list, Args &&... args) -> T &
Definition expected_void_error.h:130
constexpr auto value() &&-> T &&
Definition expected_void_error.h:102
constexpr auto has_value() const -> bool
Definition expected_void_error.h:98
constexpr friend auto operator==(Expected const &, Unexpected< G > const &) -> bool
Definition expected_void_error.h:160
constexpr auto operator=(Expected const &) -> Expected &requires(concepts::CopyConstructible< T >)=default
constexpr auto operator*() const &-> T const &
Definition expected_void_error.h:93
constexpr friend auto operator==(Expected const &a, Expected< U, G > const &b) -> bool
Definition expected_void_error.h:149
constexpr auto operator*() &&-> T &&
Definition expected_void_error.h:94
constexpr Expected(Expected const &)=delete
constexpr auto value() &-> T &
Definition expected_void_error.h:100
constexpr Expected(types::InPlace, std::initializer_list< U > list, Args &&... args)
Definition expected_void_error.h:66
constexpr friend auto tag_invoke(types::Tag< function::monad::bind >, Self &&self, F &&function) -> R
Definition expected_void_error.h:180
constexpr auto optional_value() const
Definition expected_void_error.h:120
constexpr Expected()=default
void Error
Definition expected_void_error.h:29
constexpr void const & other
Definition expected_void_error.h:51
constexpr auto operator->() const
Definition expected_void_error.h:90
constexpr ~Expected()=default
constexpr auto operator->()
Definition expected_void_error.h:89
constexpr auto value_or(U &&) const &-> T
Definition expected_void_error.h:110
constexpr auto operator=(Expected const &) -> Expected &requires(!concepts::CopyConstructible< T >)=delete
constexpr void error() const &
Definition expected_void_error.h:105
constexpr Expected(Expected &&)=default
constexpr friend auto tag_invoke(types::Tag< function::monad::fmap >, Self &&self, F &&function) -> Expected< U, void >
Definition expected_void_error.h:166
constexpr auto operator*() &-> T &
Definition expected_void_error.h:92
constexpr auto __try_did_succeed() &&-> Expected
Definition expected_void_error.h:135
constexpr Expected(Expected const &)=default
T Value
Definition expected_void_error.h:28
constexpr Expected(types::InPlace, Args &&... args)
Definition expected_void_error.h:62
constexpr auto __try_move_out() &&-> T &&
Definition expected_void_error.h:136
constexpr auto value() const &-> T const &
Definition expected_void_error.h:101
constexpr friend auto tag_invoke(types::Tag< function::monad::fail >, Self &&self, F &&) -> Expected
Definition expected_void_error.h:186
auto __try_did_fail() &&-> Expected
Definition expected_void_error.h:134
constexpr auto value_or(U &&) &&-> T
Definition expected_void_error.h:116
Definition expected_forward_declaration.h:8
Definition optional_forward_declaration.h:5
Definition unexpected.h:14
Definition operations.h:11
Definition operations.h:99
Definition operations.h:34
Definition operations.h:24
Definition operations.h:43
constexpr auto invoke
Definition invoke.h:100
di::meta::Decay< decltype(T)> Tag
Definition tag_invoke.h:28
constexpr struct di::util::SwapFunction swap
void unreachable()
Definition unreachable.h:4
Expected(T &&) -> Expected< meta::UnwrapRefDecay< T >, void >
constexpr auto in_place
Definition in_place.h:8