13#include <rpp/defs.hpp>
14#include <rpp/operators/lift.hpp>
15#include <rpp/operators/details/subscriber_with_state.hpp>
16#include <rpp/operators/fwd/distinct_until_changed.hpp>
17#include <rpp/subscribers/constraints.hpp>
18#include <rpp/utils/functors.hpp>
19#include <rpp/utils/utilities.hpp>
24IMPLEMENTATION_FILE(distinct_until_changed_tag);
28template<constra
int::decayed_type Type, std::equivalence_relation<Type, Type> EqualityFn>
31 RPP_NO_UNIQUE_ADDRESS EqualityFn equality_comparator;
32 mutable std::optional<Type> last_value{};
37 template<constra
int::decayed_type Type, std::equivalence_relation<Type, Type> EqualityFn>
38 void operator()(
auto&& new_value,
42 if (state.last_value.has_value() &&
43 state.equality_comparator(utils::as_const(state.last_value.value()),
44 utils::as_const(new_value)))
47 state.last_value.emplace(new_value);
48 sub.on_next(std::forward<
decltype(new_value)>(new_value));
52template<constra
int::decayed_type Type, std::equivalence_relation<Type, Type> EqualityFn>
55 RPP_NO_UNIQUE_ADDRESS EqualityFn equality_comparator;
57 template<constra
int::subscriber_of_type<Type> TSub>
58 auto operator()(TSub&& subscriber)
const
60 auto subscription = subscriber.get_subscription();
62 return create_subscriber_with_dynamic_state<Type>(std::move(subscription),
64 utils::forwarding_on_error{},
65 utils::forwarding_on_completed{},
66 std::forward<TSub>(subscriber),
Definition: constraints.hpp:19
Definition: distinct_until_changed.hpp:54
Definition: distinct_until_changed.hpp:36
Definition: distinct_until_changed.hpp:30