in src/iceberg/expected.h [1655:1672]
constexpr auto transform(F&& f) && {
using U =
std::remove_cvref_t<std::invoke_result_t<F, decltype(std::move(this->m_val))>>;
static_assert(expected_detail::is_value_type_valid_v<U>,
"U must be a valid type for expected<U, E>");
// FIXME another constraint needed here
if (!has_value()) {
return expected<U, E>(unexpect, std::move(error()));
} else {
if constexpr (std::is_void_v<U>) {
std::invoke(std::forward<F>(f), std::move(this->m_val));
return expected<U, E>{};
} else {
return expected<U, E>(expected_detail::construct_with_invoke_result_t{},
std::forward<F>(f), std::move(this->m_val));
}
}
}