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
3 changes: 2 additions & 1 deletion src/rpp/rpp/observables/observable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ namespace rpp
if constexpr (requires { typename std::decay_t<Op>::template operator_traits<Type>; })
{
using result_type = typename std::decay_t<Op>::template operator_traits<Type>::result_type;
return observable<result_type, details::observables::make_chain_t<std::decay_t<Op>, Strategy>>{std::forward<Op>(op), std::move(m_strategy)};
if constexpr (requires { typename std::decay_t<Op>::template operator_traits<Type>::result_type; }) // narrow compilataion error a bit
return observable<result_type, details::observables::make_chain_t<std::decay_t<Op>, Strategy>>{std::forward<Op>(op), std::move(m_strategy)};
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/rpp/rpp/operators/finally.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace rpp::operators
* @ingroup utility_operators
* @see https://reactivex.io/documentation/operators/do.html
*/
template<std::invocable<> LastFn>
template<rpp::constraint::is_nothrow_invocable LastFn>
auto finally(LastFn&& last_fn)
{
return details::finally_t<std::decay_t<LastFn>>{std::forward<LastFn>(last_fn)};
Expand Down
6 changes: 1 addition & 5 deletions src/rpp/rpp/operators/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace rpp::operators
requires (!utils::is_not_template_callable<Fn> || std::same_as<bool, std::invoke_result_t<Fn, rpp::utils::convertible_to_any>>)
auto filter(Fn&& predicate);

template<std::invocable<> LastFn>
template<rpp::constraint::is_nothrow_invocable LastFn>
auto finally(LastFn&& lastFn);

template<typename Fn>
Expand All @@ -79,10 +79,6 @@ namespace rpp::operators
template<template<typename> typename Subject = rpp::subjects::publish_subject>
auto multicast();

template<typename Fn>
requires (!utils::is_not_template_callable<Fn> || rpp::constraint::observable<std::invoke_result_t<Fn, rpp::utils::convertible_to_any>>)
auto flat_map(Fn&& callable);

template<rpp::constraint::observable TObservable, rpp::constraint::observable... TObservables>
requires constraint::observables_of_same_type<std::decay_t<TObservable>, std::decay_t<TObservables>...>
auto merge_with(TObservable&& observable, TObservables&&... observables);
Expand Down
4 changes: 2 additions & 2 deletions src/rpp/rpp/operators/group_by.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ namespace rpp::operators::details
template<rpp::constraint::decayed_type T>
struct operator_traits
{
static_assert(std::invocable<KeySelector, T>, "KeySelector is not invocacble with T");
static_assert(std::invocable<ValueSelector, T>, "ValueSelector is not invocable with T");
static_assert(!std::same_as<void, std::invoke_result_t<KeySelector, T>>, "KeySelector is not invocacble with T");
static_assert(!std::same_as<void, std::invoke_result_t<ValueSelector, T>>, "ValueSelector is not invocable with T");
static_assert(std::strict_weak_order<KeyComparator, rpp::utils::decayed_invoke_result_t<KeySelector, T>, rpp::utils::decayed_invoke_result_t<KeySelector, T>>, "KeyComparator is not invocable with result of KeySelector");

using result_type = grouped_observable<utils::decayed_invoke_result_t<KeySelector, T>, rpp::utils::decayed_invoke_result_t<ValueSelector, T>, group_by_observable_strategy<utils::decayed_invoke_result_t<ValueSelector, T>>>;
Expand Down
2 changes: 1 addition & 1 deletion src/rpp/rpp/operators/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace rpp::operators::details
template<rpp::constraint::decayed_type T>
struct operator_traits
{
static_assert(std::invocable<Fn, T>, "Fn is not invocable with T");
static_assert(!std::same_as<void, std::invoke_result_t<Fn, T>>, "Fn is not invocable with T");

using result_type = std::invoke_result_t<Fn, T>;

Expand Down
2 changes: 1 addition & 1 deletion src/rpp/rpp/utils/constraints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace rpp::constraint
concept variadic_decayed_same_as = sizeof...(Types) == 1 && (decayed_same_as<Type, Types> && ...);

template<typename T, typename Target>
concept static_pointer_convertible_to = requires { static_cast<Target*>(std::declval<T*>()); };
concept static_pointer_convertible_to = requires(T* ptr) { static_cast<Target*>(ptr); };

template<typename R>
concept iterable = requires(R& rng) {
Expand Down