RxCpp
The Reactive Extensions for Native (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++.
Classes | Namespaces | Macros | Functions
rx-pairwise.hpp File Reference

Take values pairwise from this observable. More...

#include "../rx-includes.hpp"
Include dependency graph for rx-pairwise.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rxcpp::member_overload< pairwise_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_PAIRWISE_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::pairwise (AN &&...an) -> operator_factory< pairwise_tag, AN... >
 Take values pairwise from this observable. More...
 

Detailed Description

Take values pairwise from this observable.

Returns
Observable that emits tuples of two the most recent items emitted by the source observable.
Sample Code
auto values = rxcpp::observable<>::range(1, 5).pairwise();
values.
[](std::tuple<int, int> v){printf("OnNext: %d, %d\n", std::get<0>(v), std::get<1>(v));},
[](){printf("OnCompleted\n");});
OnNext: 1, 2
OnNext: 2, 3
OnNext: 3, 4
OnNext: 4, 5
OnCompleted
If the source observable emits less than two items, no pairs are emitted by the source observable:
auto values = rxcpp::observable<>::just(1).pairwise();
values.
[](std::tuple<int, int> v){printf("OnNext: %d, %d\n", std::get<0>(v), std::get<1>(v));},
[](){printf("OnCompleted\n");});
OnCompleted

Macro Definition Documentation

#define RXCPP_OPERATORS_RX_PAIRWISE_HPP