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

Function main

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

Source from the content-addressed store, hash-verified

7 **/
8
9int main()
10{
11 //! [distinct_until_changed]
12 rpp::source::just(1, 1, 2, 2, 3, 2, 1)
13 | rpp::operators::distinct_until_changed()
14 | rpp::operators::subscribe([](int val) { std::cout << val << " "; });
15 // Output: 1 2 3 2 1
16 //! [distinct_until_changed]
17
18 std::cout << std::endl;
19 //! [distinct_until_changed_with_comparator]
20 rpp::source::just(1, 1, 2, 2, 3, 2, 1)
21 | rpp::operators::distinct_until_changed([](int left, int right) { return left != right; })
22 | rpp::operators::subscribe([](int val) { std::cout << val << " "; });
23 // Output: 1 1 1
24 //! [distinct_until_changed_with_comparator]
25 return 0;
26}

Callers

nothing calls this directly

Calls 3

justFunction · 0.85
distinct_until_changedFunction · 0.85
subscribeFunction · 0.85

Tested by

no test coverage detected