ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
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::with_latest_from
(
rpp::source::just
(3, 4, 5))
|
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::source::just
(1, 2, 3)
|
rpp::operators::with_latest_from
(
rpp::source::just
(3, 4, 5, 6, 7, 8))
|
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::source::just
(3, 4, 5))
|
rpp::operators::subscribe
([](
int
v) { std::cout << v <<
" "
; });
// Output: 4 6 8 9
return
0;
}
rpp::operators::with_latest_from
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
rpp::source::just
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition
from.hpp:201
rpp::operators::subscribe
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition
subscribe.hpp:226
Generated by
1.17.0