24 #if !defined(RXCPP_OPERATORS_RX_REPEAT_HPP) 25 #define RXCPP_OPERATORS_RX_REPEAT_HPP 27 #include "../rx-includes.hpp" 37 struct repeat_invalid_arguments {};
40 struct repeat_invalid :
public rxo::operator_base<repeat_invalid_arguments<AN...>> {
41 using type = observable<repeat_invalid_arguments<
AN...>, repeat_invalid<
AN...>>;
44 using repeat_invalid_t =
typename repeat_invalid<
AN...>::type;
48 struct event_handlers {
49 template <
typename State>
50 static inline void on_error(State& state, std::exception_ptr& e) {
51 state->out.on_error(e);
54 template <
typename State>
55 static inline void on_completed(State& state) {
58 if (state->completed_predicate()) {
59 state->out.on_completed();
61 state->do_subscribe();
67 template <
class T,
class Observable,
class Count>
68 using finite = ::rxcpp::operators::detail::retry_repeat_common::finite
69 <event_handlers, T, Observable, Count>;
72 template <
class T,
class Observable>
73 using infinite = ::rxcpp::operators::detail::retry_repeat_common::infinite
74 <event_handlers, T, Observable>;
91 template<
class Observable,
94 class Repeat = rxo::detail::repeat::infinite<SourceValue, rxu::decay_t<Observable>>,
97 static Result
member(Observable&& o) {
98 return Result(Repeat(std::forward<Observable>(o)));
101 template<
class Observable,
105 class Repeat = rxo::detail::repeat::finite<SourceValue, rxu::decay_t<Observable>,
rxu::decay_t<Count>>,
108 static Result
member(Observable&& o, Count&& c) {
109 return Result(Repeat(std::forward<Observable>(o), std::forward<Count>(c)));
112 template<
class...
AN>
113 static operators::detail::repeat_invalid_t<
AN...>
member(
AN...) {
116 static_assert(
sizeof...(
AN) == 10000,
"repeat takes (optional Count)");
static Result member(Observable &&o)
Definition: rx-repeat.hpp:97
Definition: rx-all.hpp:26
typename std::decay< T >::type::value_type value_type_t
Definition: rx-util.hpp:35
Definition: rx-operators.hpp:69
Definition: rx-operators.hpp:325
auto AN
Definition: rx-finally.hpp:105
typename std::decay< T >::type decay_t
Definition: rx-util.hpp:36
Definition: rx-operators.hpp:47
auto repeat(AN &&...an) -> operator_factory< repeat_tag, AN... >
Repeat this observable for the given number of times or infinitely.
Definition: rx-repeat.hpp:82
static Result member(Observable &&o, Count &&c)
Definition: rx-repeat.hpp:108
typename std::enable_if< all_true_type< BN... >::value >::type enable_if_all_true_type_t
Definition: rx-util.hpp:114
a source of values. subscribe or use one of the operator methods that return a new observable...
Definition: rx-observable.hpp:510
static operators::detail::repeat_invalid_t< AN... > member(AN...)
Definition: rx-repeat.hpp:113
Implementation commonalities between retry and repeat operators abstracted away from rx-retry...