ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
from.cpp
#include <rpp/rpp.hpp>
#include <iostream>
int main() // NOLINT(bugprone-exception-escape)
{
{
std::vector<int> vals{1, 2, 3};
rpp::source::from_iterable(vals).subscribe([](int v) { std::cout << v << " "; });
}
{
std::vector<int> vals{1, 2, 3};
rpp::source::from_iterable<rpp::memory_model::use_shared>(vals).subscribe([](int v) { std::cout << v << " "; });
}
{
std::vector<int> vals{1, 2, 3};
rpp::source::from_iterable(vals, rpp::schedulers::immediate{}).subscribe([](int v) { std::cout << v << " "; });
rpp::source::from_iterable(vals, rpp::schedulers::current_thread{}).subscribe([](int v) { std::cout << v << " "; });
}
{
rpp::source::from_callable([]() { return 49; }).subscribe([](int v) { std::cout << v << " "; });
// Output: 49
}
return 0;
}
Schedules execution of schedulables via queueing tasks to the caller thread with priority to time_poi...
Definition current_thread.hpp:86
immediately calls provided schedulable or waits for time_point (in the caller-thread)
Definition immediate.hpp:65
auto from_callable(Callable &&callable)
Creates rpp::specific_observable that calls provided callable and emits resulting value of this calla...
Definition from.hpp:249
auto from_iterable(Iterable &&iterable, const TScheduler &scheduler)
Creates observable that emits a items from provided iterable.
Definition from.hpp:175