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

Function main

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

Source from the content-addressed store, hash-verified

7 **/
8
9int main() // NOLINT(bugprone-exception-escape)
10{
11 //! [create]
12 rpp::source::create<int>([](const auto& sub) {
13 sub.on_next(42);
14 })
15 .subscribe([](int v) { std::cout << v << std::endl; });
16 // Output: 42
17 //! [create]
18
19 //! [create with capture]
20 int val = 42;
21 rpp::source::create<int>([val](const auto& sub) {
22 sub.on_next(val);
23 })
24 .subscribe([](int v) { std::cout << v << std::endl; });
25 // Output: 42
26 //! [create with capture]
27}

Callers

nothing calls this directly

Calls 2

subscribeMethod · 0.45
on_nextMethod · 0.45

Tested by

no test coverage detected