25 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::None;
27 RPP_NO_UNIQUE_ADDRESS TObserver observer;
28 mutable std::optional<Type> value{};
31 void on_next(T&& v)
const
33 value.emplace(std::forward<T>(v));
36 void on_completed()
const
38 if (value.has_value())
40 observer.on_next(std::move(value).value());
41 observer.on_completed();
44 observer.on_error(std::make_exception_ptr(
utils::not_enough_emissions{
"last() operator expects at least one emission from observable before completion"}));
47 void on_error(
const std::exception_ptr& err)
const { observer.on_error(err); }
51 bool is_disposed()
const {
return observer.is_disposed(); }