ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
grouped_observable.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2023 - 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/observable.hpp>
13
14namespace rpp
15{
16
26 template<constraint::decayed_type KeyType, constraint::decayed_type Type, constraint::observable_strategy<Type> Strategy>
27 class grouped_observable final : public observable<Type, Strategy>
28 {
29 public:
30 grouped_observable(KeyType key, const Strategy& strategy)
32 , m_key{std::move(key)}
33 {
34 }
35
36 grouped_observable(KeyType key, Strategy&& strategy)
37 : observable<Type, Strategy>{std::move(strategy)}
38 , m_key{std::move(key)}
39 {
40 }
41
42 const KeyType& get_key() const { return m_key; }
43
44 private:
45 KeyType m_key;
46 };
47} // namespace rpp
Extension over rpp::observable for some "subset" of values from original observable grouped by some k...
Definition grouped_observable.hpp:28
Base class for any observable used in RPP. It handles core callbacks of observable.
Definition observable.hpp:38