RxCpp
The Reactive Extensions for Native (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++.
Namespaces | Macros | Functions
rx-defer.hpp File Reference

Returns an observable that calls the specified observable factory to create an observable for each new observer that subscribes. More...

#include "../rx-includes.hpp"
Include dependency graph for rx-defer.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 rxcpp
 
 rxcpp::sources
 

Macros

#define RXCPP_SOURCES_RX_DEFER_HPP
 

Functions

template<class ObservableFactory >
auto rxcpp::sources::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 new observer that subscribes. More...
 

Detailed Description

Returns an observable that calls the specified observable factory to create an observable for each new observer that subscribes.

Template Parameters
ObservableFactorythe type of the observable factory
Parameters
ofthe observable factory function to invoke for each observer that subscribes to the resulting observable
Returns
observable whose observers' subscriptions trigger an invocation of the given observable factory function
Sample Code
auto observable_factory = [](){return rxcpp::observable<>::range(1, 3);};
auto values = rxcpp::observable<>::defer(observable_factory);
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnCompleted

Macro Definition Documentation

#define RXCPP_SOURCES_RX_DEFER_HPP