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++.
Classes | Namespaces | Macros | Functions
rx-switch_on_next.hpp File Reference

Return observable that emits the items emitted by the observable most recently emitted by the source observable. More...

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

Go to the source code of this file.

Classes

struct  rxcpp::member_overload< switch_on_next_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_SWITCH_ON_NEXT_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::switch_on_next (AN &&...an) -> operator_factory< switch_on_next_tag, AN... >
 Return observable that emits the items emitted by the observable most recently emitted by the source observable. More...
 

Detailed Description

Return observable that emits the items emitted by the observable most recently emitted by the source observable.

Template Parameters
Coordinationthe type of the scheduler (optional).
Parameters
cnthe scheduler to synchronize sources from different contexts (optional).
Returns
Observable that emits the items emitted by the observable most recently emitted by the source observable.
Sample Code
auto base = rxcpp::observable<>::interval(std::chrono::milliseconds(30)).
take(3).
map([](long){
return rxcpp::observable<>::interval(std::chrono::milliseconds(10)).as_dynamic();
});
auto values = base.switch_on_next().take(10);
values.
[](long v){printf("OnNext: %ld\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnNext: 1
OnNext: 2
OnNext: 3
OnNext: 1
OnNext: 2
OnNext: 3
OnNext: 4
OnCompleted

Macro Definition Documentation

#define RXCPP_OPERATORS_RX_SWITCH_ON_NEXT_HPP