13#include <rpp/operators/fwd.hpp>
15#include <rpp/defs.hpp>
16#include <rpp/operators/details/strategy.hpp>
18namespace rpp::operators::details
20 template<rpp::constra
int::observer TObserver, rpp::constra
int::decayed_type Fn>
23 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::None;
25 RPP_NO_UNIQUE_ADDRESS TObserver observer;
26 RPP_NO_UNIQUE_ADDRESS Fn fn;
29 void on_next(T&& v)
const
31 if (fn(rpp::utils::as_const(v)))
32 observer.on_next(std::forward<T>(v));
34 observer.on_completed();
37 void on_error(
const std::exception_ptr& err)
const { observer.on_error(err); }
39 void on_completed()
const { observer.on_completed(); }
43 bool is_disposed()
const {
return observer.is_disposed(); }
46 template<rpp::constra
int::decayed_type Fn>
51 template<rpp::constra
int::decayed_type T>
54 static_assert(std::is_invocable_r_v<bool, Fn, T>,
"Fn is not invocable with T returning bool");
56 using result_type = T;
58 template<rpp::constra
int::observer_of_type<result_type> TObserver>
62 template<rpp::details::observables::constra
int::disposables_strategy Prev>
63 using updated_optimal_disposables_strategy = Prev;
67namespace rpp::operators
Definition function_traits.hpp:45
auto take_while(Fn &&predicate)
Sends items from observable while items are satisfy predicate. When condition becomes false -> sends ...
Definition take_while.hpp:91
disposable_wrapper_impl< interface_disposable > disposable_wrapper
Wrapper to keep "simple" disposable. Specialization of rpp::disposable_wrapper_impl.
Definition fwd.hpp:34
Definition take_while.hpp:22
Definition take_while.hpp:53
Definition take_while.hpp:48