diff --git a/src/rpp/rpp/operators/subscribe.hpp b/src/rpp/rpp/operators/subscribe.hpp index 5743c8d46..4396b7bca 100644 --- a/src/rpp/rpp/operators/subscribe.hpp +++ b/src/rpp/rpp/operators/subscribe.hpp @@ -65,7 +65,7 @@ class subscribe_t { observable.subscribe(m_observer_strategy); } - + template requires rpp::constraint::observer_strategy> void operator()(const Observable& observable) && @@ -122,7 +122,7 @@ class subscribe_t observable.subscribe(m_disposable, m_observer_strategy); return m_disposable; } - + template requires rpp::constraint::observer_strategy> rpp::composite_disposable_wrapper operator()(const Observable& observable) && @@ -209,8 +209,8 @@ template subscribe_t(const Args&...) -> subscribe_t; template -concept on_next_like = (rpp::utils::is_not_template_callable && std::invocable) || - (!rpp::constraint::decayed_same_as && +concept on_next_like = (!rpp::utils::is_not_template_callable || std::invocable) && + (!rpp::constraint::decayed_same_as && !rpp::constraint::observer_strategy_base && !rpp::constraint::observer); } @@ -306,7 +306,6 @@ auto subscribe(rpp::composite_disposable_wrapper disposable, ObserverStrategy&& * @ingroup utility_operators */ template OnError = rpp::utils::rethrow_error_t, std::invocable<> OnCompleted = rpp::utils::empty_function_t<>> - auto subscribe(OnNext&& on_next = {}, OnError&& on_error = {}, OnCompleted&& on_completed = {}) { return details::subscribe_t{std::forward(on_next), std::forward(on_error), std::forward(on_completed)}; @@ -318,7 +317,6 @@ auto subscribe(OnNext&& on_next = {}, OnError&& on_error = {}, OnCompleted&& on_ * @ingroup utility_operators */ template OnCompleted> - auto subscribe(OnNext&& on_next, OnCompleted&& on_completed) { return details::subscribe_t{std::forward(on_next), rpp::utils::rethrow_error_t{}, std::forward(on_completed)}; diff --git a/src/rpp/rpp/utils/utils.hpp b/src/rpp/rpp/utils/utils.hpp index 19706b6e9..3f122b37e 100644 --- a/src/rpp/rpp/utils/utils.hpp +++ b/src/rpp/rpp/utils/utils.hpp @@ -48,7 +48,13 @@ struct convertible_to_any convertible_to_any() = default; template - operator T(); + operator T&() const; + + template + operator const T&() const; + + template + operator T&&() const; }; template> Fn>