ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
Loading...
Searching...
No Matches
first.cpp
#include <rpp/rpp.hpp>
#include <iostream>
int
main()
{
rpp::source::just
(1, 2, 3, 4, 5)
|
rpp::operators::first
()
|
rpp::operators::subscribe
(
[](
const
auto
& v) { std::cout <<
"-"
<< v; },
[](
const
std::exception_ptr&) { },
[]() { std::cout <<
"-|"
<< std::endl; });
// Source: -1-2-3-4-5--|
// Output: -1-|
rpp::source::empty<int>
()
|
rpp::operators::first
()
|
rpp::operators::subscribe
(
[](
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;
}
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::source::empty
auto empty()
Creates rpp::observable that emits no items but terminates normally.
Definition
empty.hpp:48
rpp::operators::first
auto first()
Emit only the first item.
Definition
first.hpp:87
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