Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/rpp/rpp/operators/subscribe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class subscribe_t<ObserverStrategy>
{
observable.subscribe(m_observer_strategy);
}

template<rpp::constraint::observable Observable>
requires rpp::constraint::observer_strategy<ObserverStrategy, rpp::utils::extract_observable_type_t<Observable>>
void operator()(const Observable& observable) &&
Expand Down Expand Up @@ -122,7 +122,7 @@ class subscribe_t<rpp::composite_disposable_wrapper, ObserverStrategy>
observable.subscribe(m_disposable, m_observer_strategy);
return m_disposable;
}

template<rpp::constraint::observable Observable>
requires rpp::constraint::observer_strategy<ObserverStrategy, rpp::utils::extract_observable_type_t<Observable>>
rpp::composite_disposable_wrapper operator()(const Observable& observable) &&
Expand Down Expand Up @@ -209,8 +209,8 @@ template<typename... Args>
subscribe_t(const Args&...) -> subscribe_t<Args...>;

template<typename OnNext>
concept on_next_like = (rpp::utils::is_not_template_callable<OnNext> && std::invocable<OnNext, rpp::utils::convertible_to_any>) ||
(!rpp::constraint::decayed_same_as<OnNext, rpp::composite_disposable_wrapper> &&
concept on_next_like = (!rpp::utils::is_not_template_callable<OnNext> || std::invocable<OnNext, rpp::utils::convertible_to_any>) &&
(!rpp::constraint::decayed_same_as<OnNext, rpp::composite_disposable_wrapper> &&
!rpp::constraint::observer_strategy_base<OnNext> &&
!rpp::constraint::observer<OnNext>);
}
Expand Down Expand Up @@ -306,7 +306,6 @@ auto subscribe(rpp::composite_disposable_wrapper disposable, ObserverStrategy&&
* @ingroup utility_operators
*/
template<details::on_next_like OnNext = rpp::utils::empty_function_any_t, std::invocable<const std::exception_ptr&> 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<OnNext>(on_next), std::forward<OnError>(on_error), std::forward<OnCompleted>(on_completed)};
Expand All @@ -318,7 +317,6 @@ auto subscribe(OnNext&& on_next = {}, OnError&& on_error = {}, OnCompleted&& on_
* @ingroup utility_operators
*/
template<details::on_next_like OnNext, std::invocable<> OnCompleted>

auto subscribe(OnNext&& on_next, OnCompleted&& on_completed)
{
return details::subscribe_t{std::forward<OnNext>(on_next), rpp::utils::rethrow_error_t{}, std::forward<OnCompleted>(on_completed)};
Expand Down
8 changes: 7 additions & 1 deletion src/rpp/rpp/utils/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ struct convertible_to_any
convertible_to_any() = default;

template<typename T>
operator T();
operator T&() const;

template<typename T>
operator const T&() const;

template<typename T>
operator T&&() const;
};

template<typename Cont, std::invocable<iterable_value_t<Cont>> Fn>
Expand Down