ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
subscribe_on.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/constraints.hpp>
14#include <rpp/observables/details/member_overload.hpp>
15#include <rpp/schedulers/constraints.hpp>
16
17namespace rpp::details
18{
19struct subscribe_on_tag;
20}
21
22namespace rpp::details
23{
24template<constraint::decayed_type Type, constraint::observable_of_type<Type> TObs, schedulers::constraint::scheduler TScheduler>
25auto subscribe_on_impl(TObs&& obs, TScheduler&& scheduler);
26
27template<constraint::decayed_type Type, typename SpecificObservable>
28struct member_overload<Type, SpecificObservable, subscribe_on_tag>
29{
45 template<schedulers::constraint::scheduler TScheduler>
46 auto subscribe_on(const TScheduler& scheduler) const & requires is_header_included<subscribe_on_tag, TScheduler>
47 {
48 return subscribe_on_impl<Type>(*static_cast<const SpecificObservable*>(this), scheduler);
49 }
50
51 template<schedulers::constraint::scheduler TScheduler>
52 auto subscribe_on(const TScheduler& scheduler) && requires is_header_included<subscribe_on_tag, TScheduler>
53 {
54 return subscribe_on_impl<Type>(std::move(*static_cast<SpecificObservable*>(this)), scheduler);
55 }
56};
57} // namespace rpp::details
auto subscribe_on(const TScheduler &scheduler) const &
OnSubscribe function for this observable will be scheduled via provided scheduler.
Definition: subscribe_on.hpp:46
Definition: member_overload.hpp:19