in src/iceberg/expected.h [1539:1552]
constexpr auto and_then(F&& f) const&& {
using U =
std::remove_cvref_t<std::invoke_result_t<F, decltype(std::move(this->m_val))>>;
static_assert(expected_detail::is_specialization_v<U, expected>,
"U (return type of F) must be specialization of expected");
static_assert(std::is_same_v<typename U::error_type, E>,
"The error type must be the same after calling the F");
if (has_value()) {
return std::invoke(std::forward<F>(f), std::move(this->m_val));
} else {
return U(unexpect, std::move(error()));
}
}