ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
buffer.cpp
#include <rpp/rpp.hpp>
#include <iostream>
std::ostream& operator<<(std::ostream& out, const std::vector<int>& list)
{
out << "{";
auto size = list.size();
for (size_t i = 0; i < size; ++i)
{
out << list.at(i);
if (i < size - 1)
{
out << ",";
}
}
out << "}";
return out;
}
int main()
{
// The stream that uses rvalue overloads for operators
rpp::source::just(1, 2, 3, 4, 5)
[](const std::vector<int>& v) { std::cout << v << "-"; },
[](const std::exception_ptr&) {},
[]() { std::cout << "|" << std::endl; });
// Source: -1-2-3-4-5--|
// Output: {1,2}-{3,4}-{5}-|
return 0;
}
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition from.hpp:201
auto buffer(size_t count)
Periodically gather emissions emitted by an original Observable into bundles and emit these bundles r...
Definition buffer.hpp:107
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition subscribe.hpp:226