MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / and_then_impl

Function and_then_impl

crates/cpp/test_headers/expected.hpp:2054–2060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2052 class Ret = decltype(detail::invoke(std::declval<F>(),
2053 *std::declval<Exp>()))>
2054constexpr auto and_then_impl(Exp &&exp, F &&f) {
2055 static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2056
2057 return exp.has_value()
2058 ? detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp))
2059 : Ret(unexpect, std::forward<Exp>(exp).error());
2060}
2061
2062template <class Exp, class F,
2063 detail::enable_if_t<std::is_void<exp_t<Exp>>::value> * = nullptr,

Callers 1

and_thenMethod · 0.85

Calls 2

invokeFunction · 0.85
has_valueMethod · 0.45

Tested by

no test coverage detected