ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
Loading...
Searching...
No Matches
take.cpp
#include <rpp/rpp.hpp>
#include <iostream>
int
main()
// NOLINT(bugprone-exception-escape)
{
rpp::source::from_iterable
(std::vector{0, 1, 2, 3, 4})
|
rpp::operators::take
(2)
|
rpp::operators::subscribe
([](
int
v) { std::cout << v <<
" "
; });
// Output: 0 1
return
0;
}
rpp::source::from_iterable
auto from_iterable(Iterable &&iterable, const TScheduler &scheduler)
Creates observable that emits a items from provided iterable.
Definition
from.hpp:175
rpp::operators::take
auto take(size_t count)
Emit only first count items provided by observable, then send on_completed.
Definition
take.hpp:92
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