ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
concat.cpp
#include <rpp/rpp.hpp>
#include "rpp/sources/fwd.hpp"
#include <iostream>
int main() // NOLINT(bugprone-exception-escape)
{
rpp::source::concat(rpp::source::just(1), rpp::source::just(2), rpp::source::just(1, 2, 3)).subscribe([](int v) { std::cout << v << ", "; }, [](const std::exception_ptr&) {}, []() { std::cout << "completed\n"; });
// Output: 1, 2, 1, 2, 3, completed
auto observables = std::vector{rpp::source::just(1), rpp::source::just(2)};
rpp::source::concat<rpp::memory_model::use_shared>(observables).subscribe([](int v) { std::cout << v << ", "; }, [](const std::exception_ptr&) {}, []() { std::cout << "completed\n"; });
// Output: 1, 2, completed
rpp::source::just(2).as_dynamic(),
rpp::source::just(1, 2, 3).as_dynamic())
| rpp::operators::subscribe([](int v) { std::cout << v << ", "; }, [](const std::exception_ptr&) {}, []() { std::cout << "completed\n"; });
// Output: 1, 2, 1, 2, 3, completed
}
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition from.hpp:201
auto concat()
Make observable which would merge emissions from underlying observables but without overlapping (curr...
Definition concat.hpp:242
auto concat(TObservable &&obs, TObservables &&... others)
Make observable which would merge emissions from underlying observables but without overlapping (curr...
Definition concat.hpp:171
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition subscribe.hpp:226