constexpr auto transform_error()

in src/iceberg/expected.h [2300:2311]


  constexpr auto transform_error(F&& f) && {
    using G = std::remove_cvref_t<std::invoke_result_t<F, decltype(std::move(error()))>>;
    static_assert(expected_detail::is_error_type_valid_v<G>,
                  "G must be a valid type for expected<void, G>");
    // FIXME another constraint needed here
    if (has_value()) {
      return expected<T, G>();
    } else {
      return expected<T, G>(expected_detail::construct_with_invoke_result_t{}, unexpect,
                            std::forward<F>(f), std::move(error()));
    }
  }