ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
just.cpp
#include <rpp/rpp.hpp>
#include <array>
#include <iostream>
int main() // NOLINT(bugprone-exception-escape)
{
rpp::source::just(42, 53, 10, 1).subscribe([](int v) { std::cout << v << std::endl; });
// Output: 42 53 10 1
std::array<int, 100> expensive_to_copy_1{};
std::array<int, 100> expensive_to_copy_2{};
rpp::source::just<rpp::memory_model::use_shared>(expensive_to_copy_1, expensive_to_copy_2).subscribe([](const auto&) {});
// //! [just scheduler]
rpp::source::just(rpp::schedulers::immediate{}, 42, 53).subscribe([](const auto&) {});
rpp::source::just(rpp::schedulers::current_thread{}, 42, 53).subscribe([](const auto&) {});
// //! [just scheduler]
}
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 just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition from.hpp:201