13#include "rpp/observables/specific_observable.hpp"
14#include "rpp/subscribers/constraints.hpp"
15#include <rpp/defs.hpp>
16#include <rpp/operators/details/subscriber_with_state.hpp>
17#include <rpp/operators/fwd/lift.hpp>
18#include <rpp/sources/create.hpp>
21IMPLEMENTATION_FILE(lift_tag);
25template<constra
int::decayed_type Type, constra
int::decayed_type OnNext, constra
int::decayed_type OnError, constra
int::decayed_type OnCompleted>
28 RPP_NO_UNIQUE_ADDRESS OnNext on_next;
29 RPP_NO_UNIQUE_ADDRESS OnError on_error;
30 RPP_NO_UNIQUE_ADDRESS OnCompleted on_completed;
32 template<constra
int::subscriber TSub>
33 auto operator()(TSub&& subscriber)
const
35 auto subscription = subscriber.get_subscription();
36 return create_subscriber_with_state<Type>(std::move(subscription),
40 std::forward<TSub>(subscriber));
44template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn>
45using subscriber_type_of_list_fn = utils::extract_subscriber_type_t<utils::decayed_invoke_result_t<OperatorFn, dynamic_subscriber<NewType>>>;
54template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn,
typename ...ChildLiftArgs>
57template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn,
typename TOnSubscribe>
60 using T = subscriber_type_of_list_fn<NewType, OperatorFn>;
62 RPP_NO_UNIQUE_ADDRESS OperatorFn op;
64 template<constra
int::subscriber_of_type<NewType> TSub>
65 void operator()(TSub&& subscriber)
const
67 _this.subscribe(op(std::forward<TSub>(subscriber)));
71template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn,
typename ObservableValue,
typename ...ChildLiftArgs>
74 return observable::create<NewType, lift_on_subscribe<NewType, std::decay_t<OperatorFn>, ChildLiftArgs...>>({ std::move(_this), std::forward<OperatorFn>(op) });
77template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn,
typename ObservableValue,
typename ...ChildLiftArgs>
78auto lift_impl_internal(OperatorFn&& op,
const specific_observable<ObservableValue, lift_on_subscribe<ObservableValue, ChildLiftArgs...>>& _this)
80 return observable::create<NewType, lift_on_subscribe<NewType, std::decay_t<OperatorFn>, ChildLiftArgs...>>({ _this, std::forward<OperatorFn>(op) });
83template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn,
typename ObservableValue,
typename OnSubscribe>
84auto lift_impl_internal(OperatorFn&& op, specific_observable<ObservableValue, OnSubscribe>&& _this)
86 return observable::create<NewType, lift_on_subscribe<NewType, std::decay_t<OperatorFn>, OnSubscribe>>({ std::move(_this), std::forward<OperatorFn>(op) });
89template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn,
typename ObservableValue,
typename OnSubscribe>
90auto lift_impl_internal(OperatorFn&& op,
const specific_observable<ObservableValue, OnSubscribe>& _this)
92 return observable::create<NewType, lift_on_subscribe<NewType, std::decay_t<OperatorFn>, OnSubscribe>>({ _this, std::forward<OperatorFn>(op) });
95template<constra
int::decayed_type NewType, lift_fn<NewType> OperatorFn,
typename TObs>
96auto lift_impl(OperatorFn&& op, TObs&& _this)
98 return lift_impl_internal<NewType>(std::forward<OperatorFn>(op), std::forward<TObs>(_this));
Type-full observable (or typed) that has the notion of Type and upstream observables for C++ compiler...
Definition: specific_observable.hpp:39
Functor of "lift" operator for on_subscribe overload function.
Definition: lift.hpp:55