* @example with_latest_from.cpp **/
| 6 | * @example with_latest_from.cpp |
| 7 | **/ |
| 8 | int main() |
| 9 | { |
| 10 | //! [with_latest_from] |
| 11 | rpp::source::just(1, 2, 3, 4, 5, 6) |
| 12 | | rpp::operators::with_latest_from(rpp::source::just(3, 4, 5)) |
| 13 | | rpp::operators::subscribe([](std::tuple<int, int> v) { std::cout << std::get<0>(v) << ":" << std::get<1>(v) << " "; }); |
| 14 | // Output: 1:3 2:4 3:5 4:5 5:5 6:5 |
| 15 | |
| 16 | std::cout << std::endl; |
| 17 | |
| 18 | rpp::source::just(1, 2, 3) |
| 19 | | rpp::operators::with_latest_from(rpp::source::just(3, 4, 5, 6, 7, 8)) |
| 20 | | rpp::operators::subscribe([](std::tuple<int, int> v) { std::cout << std::get<0>(v) << ":" << std::get<1>(v) << " "; }); |
| 21 | // Output: 1:3 2:4 3:5 |
| 22 | //! [with_latest_from] |
| 23 | |
| 24 | std::cout << std::endl; |
| 25 | |
| 26 | //! [with_latest_from custom selector] |
| 27 | rpp::source::just(1, 2, 3, 4) |
| 28 | | rpp::operators::with_latest_from([](int left, int right) { return left + right; }, |
| 29 | rpp::source::just(3, 4, 5)) |
| 30 | | rpp::operators::subscribe([](int v) { std::cout << v << " "; }); |
| 31 | // Output: 4 6 8 9 |
| 32 | //! [with_latest_from custom selector] |
| 33 | return 0; |
| 34 | } |
nothing calls this directly
no test coverage detected