ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
sample.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2022 - 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/observables/details/member_overload.hpp>
14#include <rpp/schedulers/constraints.hpp>
15#include <rpp/schedulers/trampoline_scheduler.hpp>
16
17namespace rpp::details
18{
19struct sample_tag;
20}
21
22namespace rpp::details
23{
24template<constraint::decayed_type Type, schedulers::constraint::scheduler TScheduler>
25struct sample_with_time_impl;
26
27template<constraint::decayed_type Type, typename SpecificObservable>
28struct member_overload<Type, SpecificObservable, sample_tag>
29{
65 template<schedulers::constraint::scheduler TScheduler, typename ...Args>
66 auto sample_with_time(schedulers::duration period, const TScheduler& scheduler) const & requires is_header_included<sample_tag, TScheduler, Args...>
67 {
68 return static_cast<const SpecificObservable*>(this)->template lift<Type>(sample_with_time_impl<Type, TScheduler>{period, scheduler});
69 }
70
71 template<schedulers::constraint::scheduler TScheduler, typename ...Args>
72 auto sample_with_time(schedulers::duration period, const TScheduler& scheduler) && requires is_header_included<sample_tag, TScheduler, Args...>
73 {
74 return std::move(*static_cast<SpecificObservable*>(this)).template lift<Type>(sample_with_time_impl<Type, TScheduler>{period, scheduler});
75 }
76};
77} // namespace rpp::details
Definition: constraints.hpp:31
Definition: member_overload.hpp:19
Definition: sample.hpp:73