ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
take_while.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::take_while([](int v) { return v != 5; })
| rpp::operators::subscribe([](int v) { std::cout << v << " "; });
// Output: 0 1 2 3 4
return 0;
}
auto take_while(Fn &&predicate)
Sends items from observable while items are satisfy predicate. When condition becomes false -> sends ...
Definition take_while.hpp:91
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition from.hpp:201
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition subscribe.hpp:226