ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
dynamic_subscriber.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/subscribers/specific_subscriber.hpp>
14#include <rpp/observers/dynamic_observer.hpp>
15
16namespace rpp
17{
22template<constraint::decayed_type T>
23class dynamic_subscriber final : public specific_subscriber<T, dynamic_observer<T>>
24{
25public:
26 using specific_subscriber<T, dynamic_observer<T>>::specific_subscriber;
27
28 template<constraint::subscriber_of_type<T> TSub>
29 requires (!std::is_same_v<std::decay_t<TSub>, dynamic_subscriber<T>>)
30 dynamic_subscriber(const TSub& subscriber)
31 : specific_subscriber<T, dynamic_observer<T>>{subscriber.get_subscription(),
32 subscriber.get_observer()} {}
33};
34
35template<constraint::observer TObs>
37
38template<constraint::observer TObs>
40
41template<typename T, typename Obs>
43
44template<typename OnNext, typename ...Args>
46
47template<typename OnNext, typename ...Args>
49} // namespace rpp
rpp::subscription_base with ability to add some dependent subscriptions as a part of this one: in cas...
Definition: composite_subscription.hpp:30
Dynamic (type-erased) version of observer (comparing to specific_observer)
Definition: dynamic_observer.hpp:109
subscriber which uses dynamic_observer<T> to hide original callbacks
Definition: dynamic_subscriber.hpp:24
specific version of subscriber which stores type of observer used inside to prevent extra allocations
Definition: specific_subscriber.hpp:31