From 9e5a83230f328cb61876c01b584bcdb0f9845fbf Mon Sep 17 00:00:00 2001 From: CorentinBT Date: Sun, 18 Feb 2024 20:51:14 +0100 Subject: [PATCH 1/2] Add missing operators and sources fwd --- src/rpp/rpp/operators/fwd.hpp | 42 +++++++++++++++++++++++++++++++++++ src/rpp/rpp/sources/fwd.hpp | 23 +++++++++++++++++-- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/rpp/rpp/operators/fwd.hpp b/src/rpp/rpp/operators/fwd.hpp index b1a6ba879..663bf948d 100644 --- a/src/rpp/rpp/operators/fwd.hpp +++ b/src/rpp/rpp/operators/fwd.hpp @@ -39,6 +39,8 @@ namespace rpp::operators template auto delay(rpp::schedulers::duration delay_duration, Scheduler&& scheduler); + auto distinct(); + template requires (!utils::is_not_template_callable || std::same_as>) auto distinct_until_changed(EqualityFn&& equality_fn = {}); @@ -49,6 +51,10 @@ namespace rpp::operators requires (!utils::is_not_template_callable || std::same_as>) auto filter(Fn&& predicate); + template + requires (!utils::is_not_template_callable || rpp::constraint::observable>) + auto flat_map(Fn&& callable); + template @@ -82,6 +88,13 @@ namespace rpp::operators auto publish(); + template + requires (!utils::is_not_template_callable || std::same_as, std::invoke_result_t &&, rpp::utils::convertible_to_any>>) + auto reduce(Seed&& seed, Accumulator&& accumulator); + + template + auto reduce(Accumulator&& accumulator); + auto ref_count(); auto repeat(size_t count); @@ -133,9 +146,31 @@ namespace rpp::operators template auto take_until(TObservable&& until_observable); + template OnError = rpp::utils::empty_function_t> + auto tap(OnError&& on_error); + + template OnCompleted = rpp::utils::empty_function_t<>> + auto tap(OnCompleted&& on_completed); + + template OnCompleted = rpp::utils::empty_function_t<>> + auto tap(OnNext&& on_next, + OnCompleted&& on_completed); + + template OnError = rpp::utils::empty_function_t, + std::invocable<> OnCompleted = rpp::utils::empty_function_t<>> + auto tap(OnNext&& on_next = {}, + OnError&& on_error = {}, + OnCompleted&& on_completed = {}); + template auto throttle(rpp::schedulers::duration period); + template + requires rpp::constraint::observable> + auto on_error_resume_next(Selector&& selector); + template requires (!rpp::constraint::observable && (!utils::is_not_template_callable || std::invocable, utils::extract_observable_type_t...>)) auto with_latest_from(TSelector&& selector, TObservable&& observable, TObservables&&... observables); @@ -148,6 +183,13 @@ namespace rpp::operators template requires rpp::constraint::observable>> auto window_toggle(TOpeningsObservable&& openings, TClosingsSelectorFn&& closings_selector); + + template + requires (!rpp::constraint::observable && (!utils::is_not_template_callable || std::invocable, utils::extract_observable_type_t...>)) + auto zip(TSelector&& selector, TObservable&& observable, TObservables&&... observables); + + template + auto zip(TObservable&& observable, TObservables&&... observables); } // namespace rpp::operators namespace rpp diff --git a/src/rpp/rpp/sources/fwd.hpp b/src/rpp/rpp/sources/fwd.hpp index e10575fc5..08691c68c 100644 --- a/src/rpp/rpp/sources/fwd.hpp +++ b/src/rpp/rpp/sources/fwd.hpp @@ -61,12 +61,31 @@ namespace rpp::source requires constraint::observable> auto concat(Iterable&& iterable); - template - auto never(); + template + requires rpp::constraint::observable> + auto defer(Factory&& observable_factory); template auto error(std::exception_ptr err); template auto empty(); + + template + auto interval(rpp::schedulers::duration initial, rpp::schedulers::duration period, TScheduler&& scheduler); + + template + auto interval(rpp::schedulers::time_point initial, rpp::schedulers::duration period, TScheduler&& scheduler); + + template + auto interval(rpp::schedulers::duration period, TScheduler&& scheduler); + + template + auto never(); + + template + auto timer(rpp::schedulers::duration when, TScheduler&& scheduler); + + template + auto timer(rpp::schedulers::time_point when, TScheduler&& scheduler); } // namespace rpp::source \ No newline at end of file From 9f8313543a0ad7c1a0b51652683a6d030e36d2a4 Mon Sep 17 00:00:00 2001 From: CorentinBT Date: Sun, 18 Feb 2024 21:00:56 +0100 Subject: [PATCH 2/2] Fix build --- src/rpp/rpp/operators/tap.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/rpp/rpp/operators/tap.hpp b/src/rpp/rpp/operators/tap.hpp index d0d0fcb48..74d20b052 100644 --- a/src/rpp/rpp/operators/tap.hpp +++ b/src/rpp/rpp/operators/tap.hpp @@ -89,7 +89,7 @@ namespace rpp::operators * @ingroup utility_operators * @see https://reactivex.io/documentation/operators/do.html */ - template OnError = rpp::utils::empty_function_t> + template OnError /* = rpp::utils::empty_function_t */> auto tap(OnError&& on_error) { using OnNext = rpp::utils::empty_function_any_t; @@ -109,7 +109,7 @@ namespace rpp::operators * @ingroup utility_operators * @see https://reactivex.io/documentation/operators/do.html */ - template OnCompleted = rpp::utils::empty_function_t<>> + template OnCompleted /* = rpp::utils::empty_function_t<> */> auto tap(OnCompleted&& on_completed) { using OnNext = rpp::utils::empty_function_any_t; @@ -131,7 +131,7 @@ namespace rpp::operators * @see https://reactivex.io/documentation/operators/do.html */ template OnCompleted = rpp::utils::empty_function_t<>> + std::invocable<> OnCompleted /* = rpp::utils::empty_function_t<> */> auto tap(OnNext&& on_next, OnCompleted&& on_completed) { @@ -153,12 +153,12 @@ namespace rpp::operators * @ingroup utility_operators * @see https://reactivex.io/documentation/operators/do.html */ - template OnError = rpp::utils::empty_function_t, - std::invocable<> OnCompleted = rpp::utils::empty_function_t<>> - auto tap(OnNext&& on_next = {}, - OnError&& on_error = {}, - OnCompleted&& on_completed = {}) + template OnError /* = rpp::utils::empty_function_t */, + std::invocable<> OnCompleted /* = rpp::utils::empty_function_t<> */> + auto tap(OnNext&& on_next /* = {} */, + OnError&& on_error /* = {} */, + OnCompleted&& on_completed /* = {} */) { return details::tap_t, std::decay_t, std::decay_t>{ std::forward(on_next),