MCPcopy Create free account
hub / github.com/AlexInLog/ReactivePlusPlus / main

Function main

src/examples/rpp/doxygen/from.cpp:9–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7 **/
8
9int main() // NOLINT(bugprone-exception-escape)
10{
11 {
12 //! [from_iterable]
13 std::vector<int> vals{1, 2, 3};
14 rpp::source::from_iterable(vals).subscribe([](int v) { std::cout << v << " "; });
15 //! [from_iterable]
16 }
17
18 {
19 //! [from_iterable with model]
20 std::vector<int> vals{1, 2, 3};
21 rpp::source::from_iterable<rpp::memory_model::use_shared>(vals).subscribe([](int v) { std::cout << v << " "; });
22 //! [from_iterable with model]
23 }
24
25 {
26 //! [from_iterable with scheduler]
27 std::vector<int> vals{1, 2, 3};
28 rpp::source::from_iterable(vals, rpp::schedulers::immediate{}).subscribe([](int v) { std::cout << v << " "; });
29 rpp::source::from_iterable(vals, rpp::schedulers::current_thread{}).subscribe([](int v) { std::cout << v << " "; });
30 //! [from_iterable with scheduler]
31 }
32
33 {
34 //! [from_callable]
35 rpp::source::from_callable([]() { return 49; }).subscribe([](int v) { std::cout << v << " "; });
36 // Output: 49
37 //! [from_callable]
38 }
39 return 0;
40}

Callers

nothing calls this directly

Calls 3

from_iterableFunction · 0.85
from_callableFunction · 0.85
subscribeMethod · 0.45

Tested by

no test coverage detected