ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
with_latest_from.cpp
#include <rpp/rpp.hpp>
#include <iostream>
int main()
{
rpp::source::just(1, 2, 3, 4, 5, 6)
| rpp::operators::subscribe([](std::tuple<int, int> v) { std::cout << std::get<0>(v) << ":" << std::get<1>(v) << " "; });
// Output: 1:3 2:4 3:5 4:5 5:5 6:5
std::cout << std::endl;
| rpp::operators::subscribe([](std::tuple<int, int> v) { std::cout << std::get<0>(v) << ":" << std::get<1>(v) << " "; });
// Output: 1:3 2:4 3:5
std::cout << std::endl;
rpp::source::just(1, 2, 3, 4)
| rpp::operators::with_latest_from([](int left, int right) { return left + right; },
| rpp::operators::subscribe([](int v) { std::cout << v << " "; });
// Output: 4 6 8 9
return 0;
}
auto with_latest_from(TSelector &&selector, TObservable &&observable, TObservables &&... observables)
Combines latest emissions from observables with emission from current observable when it sends new va...
Definition with_latest_from.hpp:197
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition from.hpp:201
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition subscribe.hpp:226