ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
first.cpp
#include <rpp/rpp.hpp>
#include <iostream>
int main()
{
rpp::source::just(1, 2, 3, 4, 5)
[](const auto& v) { std::cout << "-" << v; },
[](const std::exception_ptr&) {},
[]() { std::cout << "-|" << std::endl; });
// Source: -1-2-3-4-5--|
// Output: -1-|
[](const auto& v) { std::cout << "-" << v; },
[](const std::exception_ptr&) { std::cout << "-x" << std::endl; },
[]() { std::cout << "-|" << std::endl; });
// Source: -1-2-3-4-5--|
// Output: -x
return 0;
}
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition from.hpp:201
auto empty()
Creates rpp::observable that emits no items but terminates normally.
Definition empty.hpp:48
auto first()
Emit only the first item.
Definition first.hpp:87
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition subscribe.hpp:226