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

Function main

src/examples/rpp/doxygen/concat.cpp:11–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9 **/
10
11int main() // NOLINT(bugprone-exception-escape)
12{
13 //! [concat_as_source]
14 rpp::source::concat(rpp::source::just(1), rpp::source::just(2), rpp::source::just(1, 2, 3)).subscribe([](int v) { std::cout << v << ", "; }, [](const std::exception_ptr&) {}, []() { std::cout << "completed\n"; });
15 // Output: 1, 2, 1, 2, 3, completed
16 //! [concat_as_source]
17
18 //! [concat_as_source_vector]
19 auto observables = std::vector{rpp::source::just(1), rpp::source::just(2)};
20 rpp::source::concat<rpp::memory_model::use_shared>(observables).subscribe([](int v) { std::cout << v << ", "; }, [](const std::exception_ptr&) {}, []() { std::cout << "completed\n"; });
21 // Output: 1, 2, completed
22 //! [concat_as_source_vector]
23
24 //! [concat_as_operator]
25 rpp::source::just(rpp::source::just(1).as_dynamic(),
26 rpp::source::just(2).as_dynamic(),
27 rpp::source::just(1, 2, 3).as_dynamic())
28 | rpp::operators::concat()
29 | rpp::operators::subscribe([](int v) { std::cout << v << ", "; }, [](const std::exception_ptr&) {}, []() { std::cout << "completed\n"; });
30 // Output: 1, 2, 1, 2, 3, completed
31 //! [concat_as_operator]
32}

Callers

nothing calls this directly

Calls 5

justFunction · 0.85
subscribeFunction · 0.85
concatFunction · 0.50
subscribeMethod · 0.45
as_dynamicMethod · 0.45

Tested by

no test coverage detected