ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
grouped_observable.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/observables/specific_observable.hpp>
13
14namespace rpp
15{
16template<constraint::decayed_type KeyType,
17 constraint::decayed_type Type,
18 constraint::on_subscribe_fn<Type> OnSubscribeFn>
19class grouped_observable final : public specific_observable<Type, OnSubscribeFn>
20{
21public:
22 grouped_observable(KeyType key, const OnSubscribeFn& on_subscribe)
24 , m_key{std::move(key)} {}
25
26 grouped_observable(KeyType key, OnSubscribeFn&& on_subscribe)
27 : specific_observable<Type, OnSubscribeFn>{std::move(on_subscribe)}
28 , m_key{std::move(key)} {}
29
30 const KeyType& get_key() const { return m_key; }
31
32private:
33 KeyType m_key;
34};
35} // namespace rpp
36
Definition: grouped_observable.hpp:20
Type-full observable (or typed) that has the notion of Type and upstream observables for C++ compiler...
Definition: specific_observable.hpp:39