ReactivePlusPlus
ReactiveX implementation for C++20
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::subscribe([](int v) { std::cout << v << " "; });
// Output: 0 1
return 0;
}
auto from_iterable(Iterable &&iterable, const TScheduler &scheduler)
Creates observable that emits a items from provided iterable.
Definition from.hpp:175
auto take(size_t count)
Emit only first count items provided by observable, then send on_completed
Definition take.hpp:92
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition subscribe.hpp:226