ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
repeat.hpp
1
// ReactivePlusPlus library
2
//
3
// Copyright Aleksey Loginov 2023 - present.
4
// Distributed under the Boost Software License, Version 1.0.
5
// (See accompanying file LICENSE_1_0.txt or copy at
6
// https://www.boost.org/LICENSE_1_0.txt)
7
//
8
// Project home: https://github.com/victimsnino/ReactivePlusPlus
9
//
10
11
#pragma once
12
13
#include <rpp/operators/fwd.hpp>
14
15
#include <rpp/sources/concat.hpp>
16
#include <rpp/utils/utils.hpp>
17
18
#include <cstddef>
19
20
namespace
rpp::operators::details
21
{
22
struct
repeat_t
23
{
24
size_t
count;
25
26
template
<rpp::constra
int
::observable TObservable>
27
auto
operator()(TObservable&&
observable
)
const
28
{
29
return
rpp::source::concat
(
utils::repeated_container
{std::forward<TObservable>(
observable
), count});
30
}
31
};
32
33
struct
infinite_repeat_t
34
{
35
template
<rpp::constra
int
::observable TObservable>
36
auto
operator()(TObservable&&
observable
)
const
37
{
38
return
rpp::source::concat
(
utils::infinite_repeated_container
{std::forward<TObservable>(
observable
)});
39
}
40
};
41
}
// namespace rpp::operators::details
42
43
namespace
rpp::operators
44
{
66
* @ingroup utility_operators
67
* @see https://reactivex.io/documentation/operators/repeat.html
68
*/
69
70
inline
auto
repeat
(
size_t
count)
71
{
72
return
details::repeat_t
{count};
73
}
74
86
* @note `#include <rpp/operators/repeat.hpp>`
87
*
88
* @par Examples:
89
* @snippet repeat.cpp repeat_infinitely
90
*
91
* @ingroup utility_operators
92
* @see https://reactivex.io/documentation/operators/repeat.html
93
*/
94
inline
auto
repeat
()
95
{
96
return
details::infinite_repeat_t
{};
97
}
98
}
// namespace rpp::operators
rpp::observable
Base class for any observable used in RPP. It handles core callbacks of observable.
Definition
observable.hpp:38
rpp::utils::infinite_repeated_container
Definition
utils.hpp:205
rpp::utils::repeated_container
Definition
utils.hpp:143
rpp::source::concat
auto concat(TObservable &&obs, TObservables &&... others)
Make observable which would merge emissions from underlying observables but without overlapping (curr...
Definition
concat.hpp:168
rpp::operators::repeat
auto repeat()
Repeats the Observabe's sequence of emissions infinite amount of times via re-subscribing on it durin...
Definition
repeat.hpp:86
rpp::operators::details::infinite_repeat_t
Definition
repeat.hpp:34
rpp::operators::details::repeat_t
Definition
repeat.hpp:23
src
rpp
rpp
operators
repeat.hpp
Generated by
1.13.2