20 #if !defined(RXCPP_OPERATORS_RX_TAKE_WHILE_HPP) 21 #define RXCPP_OPERATORS_RX_TAKE_WHILE_HPP 23 #include "../rx-includes.hpp" 32 struct take_while_invalid_arguments {};
35 struct take_while_invalid :
public rxo::operator_base<take_while_invalid_arguments<AN...>> {
36 using type = observable<take_while_invalid_arguments<
AN...>, take_while_invalid<
AN...>>;
39 using take_while_invalid_t =
typename take_while_invalid<
AN...>::type;
41 template<
class T,
class Predicate>
44 typedef rxu::decay_t<T> source_value_type;
45 typedef rxu::decay_t<Predicate> test_type;
54 template<
class Subscriber>
55 struct take_while_observer
57 typedef take_while_observer<Subscriber> this_type;
58 typedef source_value_type value_type;
59 typedef rxu::decay_t<Subscriber> dest_type;
60 typedef observer<value_type, this_type> observer_type;
64 take_while_observer(dest_type d, test_type t)
69 void on_next(source_value_type v)
const {
76 void on_error(std::exception_ptr e)
const {
79 void on_completed()
const {
83 static subscriber<value_type, observer_type> make(dest_type d, test_type t) {
84 return make_subscriber<value_type>(d, this_type(d, std::move(t)));
88 template<
class Subscriber>
89 auto operator()(Subscriber dest)
const 90 -> decltype(take_while_observer<Subscriber>::make(std::move(dest), test)) {
91 return take_while_observer<Subscriber>::make(std::move(dest), test);
102 return operator_factory<take_while_tag,
AN...>(std::make_tuple(std::forward<AN>(an)...));
110 template<
class Observable,
class Predicate,
112 class TakeWhile = rxo::detail::take_while<SourceValue, rxu::decay_t<Predicate>>>
113 static auto member(Observable&& o, Predicate&& p)
114 -> decltype(o.template lift<SourceValue>(TakeWhile(std::forward<Predicate>(p)))) {
115 return o.template lift<SourceValue>(TakeWhile(std::forward<Predicate>(p)));
118 template<
class...
AN>
119 static operators::detail::take_while_invalid_t<
AN...>
member(
const AN&...) {
122 static_assert(
sizeof...(
AN) == 10000,
"take_while takes (Predicate)");
Definition: rx-all.hpp:26
typename std::decay< T >::type::value_type value_type_t
Definition: rx-util.hpp:35
static auto member(Observable &&o, Predicate &&p) -> decltype(o.template lift< SourceValue >(TakeWhile(std::forward< Predicate >(p))))
Definition: rx-take_while.hpp:113
Definition: rx-operators.hpp:431
Definition: rx-operators.hpp:69
auto AN
Definition: rx-finally.hpp:105
Definition: rx-operators.hpp:47
auto take_while(AN &&...an) -> operator_factory< take_while_tag, AN... >
For the first items fulfilling the predicate from this observable emit them from the new observable t...
Definition: rx-take_while.hpp:100
static operators::detail::take_while_invalid_t< AN... > member(const AN &...)
Definition: rx-take_while.hpp:119