ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
Loading...
Searching...
No Matches
filter.cpp
#include <rpp/rpp.hpp>
#include <iostream>
int
main()
// NOLINT(bugprone-exception-escape)
{
rpp::source::just
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
|
rpp::operators::filter
([](
int
v) {
return
v % 2 == 0; })
|
rpp::operators::subscribe
([](
int
v) { std::cout << v <<
" "
; });
// Output: 0 2 4 6 8
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::operators::filter
auto filter(Fn &&predicate)
Emit only those items from an Observable that satisfies a provided predicate.
Definition
filter.hpp:91
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