ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
subject_on_subscribe.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#pragma once
11
12#include <rpp/sources/fwd.hpp>
13
14#include <rpp/observables/observable.hpp>
15
16namespace rpp::subjects::details
17{
18 template<constraint::decayed_type Type, ::rpp::constraint::on_subscribe<Type> OnSubscribe, typename DisposableStrategy>
20 {
21 using value_type = Type;
22 using optimal_disposables_strategy = DisposableStrategy;
23
24 RPP_NO_UNIQUE_ADDRESS OnSubscribe subscribe;
25 };
26
27 template<constraint::decayed_type Type, typename DisposableStrategy, rpp::constraint::on_subscribe<Type> OnSubscribe>
28 auto create_subject_on_subscribe_observable(OnSubscribe&& on_subscribe)
29 {
30 return rpp::observable<Type, subject_on_subscribe_strategy<Type, std::decay_t<OnSubscribe>, DisposableStrategy>>(std::forward<OnSubscribe>(on_subscribe));
31 }
32} // namespace rpp::subjects::details
Base class for any observable used in RPP. It handles core callbacks of observable.
Definition observable.hpp:38
Definition subject_on_subscribe.hpp:20