13#include <rpp/operators/fwd.hpp>
15#include <rpp/defs.hpp>
16#include <rpp/operators/details/strategy.hpp>
17#include <rpp/utils/constraints.hpp>
19#include <unordered_set>
21namespace rpp::operators::details
23 template<rpp::constra
int::decayed_type Type, rpp::constra
int::observer TObserver>
26 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::None;
28 RPP_NO_UNIQUE_ADDRESS TObserver observer;
29 mutable std::unordered_set<Type> past_values{};
32 void on_next(T&& v)
const
34 const auto [it, inserted] = past_values.insert(std::forward<T>(v));
37 observer.on_next(*it);
41 void on_error(
const std::exception_ptr& err)
const { observer.on_error(err); }
43 void on_completed()
const { observer.on_completed(); }
47 bool is_disposed()
const {
return observer.is_disposed(); }
52 using lift_operator<
distinct_t>::lift_operator;
54 template<rpp::constra
int::decayed_type T>
59 using result_type = T;
61 template<rpp::constra
int::observer_of_type<result_type> TObserver>
65 template<rpp::details::observables::constra
int::disposables_strategy Prev>
66 using updated_optimal_disposables_strategy = Prev;
70namespace rpp::operators
Definition constraints.hpp:56
disposable_wrapper_impl< interface_disposable > disposable_wrapper
Wrapper to keep "simple" disposable. Specialization of rpp::disposable_wrapper_impl.
Definition fwd.hpp:34
auto distinct()
For each item from this observable, filter out repeated values and emit only items that have not alre...
Definition distinct.hpp:82
Definition distinct.hpp:25
Definition distinct.hpp:56
Definition distinct.hpp:51