ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
Loading...
Searching...
No Matches
map.cpp
#include <rpp/rpp.hpp>
#include <iostream>
int
main()
// NOLINT(bugprone-exception-escape)
{
rpp::source::just
(42)
|
rpp::operators::map
([](
int
value) {
return
value + 10; })
|
rpp::operators::subscribe
([](
int
v) { std::cout << v << std::endl; });
// Output: 52
rpp::source::just
(42)
|
rpp::operators::map
([](
int
value) {
return
std::to_string(value) +
" VAL"
; })
|
rpp::operators::subscribe
([](
const
std::string& v) { std::cout << v << std::endl; });
// Output: 42 VAL
return
0;
}
rpp::source::just
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition
from.hpp:201
rpp::operators::map
auto map(Fn &&callable)
Transforms the items emitted by an Observable via applying a function to each item and emitting resul...
Definition
map.hpp:94
rpp::operators::subscribe
auto subscribe(observer< Type, ObserverStrategy > &&observer)
Subscribes passed observer to emissions from this observable.
Definition
subscribe.hpp:226
Generated by
1.17.0