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... >
 

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\n
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

◆ RXCPP_OPERATORS_RX_PAIRWISE_HPP

#define RXCPP_OPERATORS_RX_PAIRWISE_HPP
rxcpp::sources::range
auto range(T first=0, T last=std::numeric_limits< T >::max(), std::ptrdiff_t step=1) -> observable< T, detail::range< T, identity_one_worker >>
Definition: rx-range.hpp:119
rxcpp::operators::subscribe
auto subscribe(ArgN &&... an) -> detail::subscribe_factory< decltype(make_subscriber< T >(std::forward< ArgN >(an)...))>
Definition: rx-subscribe.hpp:87
rxcpp::sources::just
auto just(Value0 v0) -> typename std::enable_if<!is_coordination< Value0 >::value, decltype(iterate(*(std::array< Value0, 1 > *) nullptr, identity_immediate()))>::type
Definition: rx-iterate.hpp:267