in src/iceberg/expected.h [1491:1504]
constexpr auto and_then(F&& f) & {
using U = std::remove_cvref_t<std::invoke_result_t<F, decltype((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), this->m_val);
} else {
return U(unexpect, error());
}
}