5 #if !defined(RXCPP_SOURCES_RX_DEFER_HPP) 6 #define RXCPP_SOURCES_RX_DEFER_HPP 8 #include "../rx-includes.hpp" 31 template<
class ObservableFactory>
34 typedef rxu::decay_t<ObservableFactory> observable_factory_type;
35 typedef decltype((*(observable_factory_type*)
nullptr)()) collection_type;
36 typedef typename collection_type::value_type value_type;
39 template<
class ObservableFactory>
40 struct defer :
public source_base<rxu::value_type_t<defer_traits<ObservableFactory>>>
42 typedef defer<ObservableFactory> this_type;
43 typedef defer_traits<ObservableFactory> traits;
45 typedef typename traits::observable_factory_type observable_factory_type;
46 typedef typename traits::collection_type collection_type;
48 observable_factory_type observable_factory;
50 defer(observable_factory_type of)
51 : observable_factory(std::move(of))
54 template<
class Subscriber>
55 void on_subscribe(Subscriber o)
const {
58 [
this](){
return this->observable_factory();},
60 if (selectedCollection.empty()) {
64 selectedCollection->subscribe(o);
72 template<
class ObservableFactory>
73 auto defer(ObservableFactory of)
76 detail::defer<ObservableFactory>(std::move(of)));
Definition: rx-all.hpp:26
a source of values. subscribe or use one of the operator methods that return a new observable...
Definition: rx-observable.hpp:510
auto defer(ObservableFactory of) -> observable< rxu::value_type_t< detail::defer_traits< ObservableFactory >>, detail::defer< ObservableFactory >>
Returns an observable that calls the specified observable factory to create an observable for each ne...
Definition: rx-defer.hpp:73
auto on_exception(const F &f, const OnError &c) -> typename std::enable_if< detail::is_on_error< OnError >::value, typename detail::maybe_from_result< F >::type >::type
Definition: rx-observer.hpp:639