* @example repeat.cpp **/
| 7 | * @example repeat.cpp |
| 8 | **/ |
| 9 | int main() |
| 10 | { |
| 11 | //! [repeat] |
| 12 | rpp::source::just(1, 2, 3) |
| 13 | | rpp::operators::repeat(2) |
| 14 | | rpp::operators::subscribe([](int v) { std::cout << v << " "; }, |
| 15 | [](const std::exception_ptr&) {}, |
| 16 | []() { std::cout << "completed" << std::endl; }); |
| 17 | // Output: 1 2 3 1 2 3 completed |
| 18 | //! [repeat] |
| 19 | |
| 20 | //! [repeat_infinitely] |
| 21 | rpp::source::just(1, 2, 3) |
| 22 | | rpp::operators::repeat() |
| 23 | | rpp::operators::take(10) |
| 24 | | rpp::operators::subscribe([](int v) { std::cout << v << " "; }, |
| 25 | [](const std::exception_ptr&) {}, |
| 26 | []() { |
| 27 | std::cout << "completed" << std::endl; |
| 28 | }); |
| 29 | // Output: 1 2 3 1 2 3 1 2 3 1 completed |
| 30 | //! [repeat_infinitely] |
| 31 | return 0; |
| 32 | } |