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-repeat.hpp File Reference

Repeat this observable for the given number of times or infinitely. More...

#include "../rx-includes.hpp"
#include "rx-retry-repeat-common.hpp"
Include dependency graph for rx-repeat.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< repeat_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_REPEAT_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::repeat (AN &&...an) -> operator_factory< repeat_tag, AN... >
 Repeat this observable for the given number of times or infinitely. More...
 

Detailed Description

Repeat this observable for the given number of times or infinitely.

Template Parameters
Countthe type of the counter (optional).
Parameters
tThe number of times the source observable items are repeated (optional). If not specified, infinitely repeats the source observable. Specifying 0 returns an empty sequence immediately
Returns
An observable that repeats the sequence of items emitted by the source observable for t times.
Sample Code
auto values = rxcpp::observable<>::from(1, 2).repeat(3);
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 1
OnNext: 2
OnNext: 1
OnNext: 2
OnCompleted
If the source observable calls on_error, repeat stops:
auto values = rxcpp::observable<>::from(1, 2).
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
repeat();
values.
[](int v){printf("OnNext: %d\n", v);},
[](std::exception_ptr ep){
try {std::rethrow_exception(ep);}
catch (const std::exception& ex) {
printf("OnError: %s\n", ex.what());
}
},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnError: Error from source

Macro Definition Documentation

#define RXCPP_OPERATORS_RX_REPEAT_HPP