ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
interface_composite_disposable.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
11#pragma once
12
13#include <rpp/disposables/callback_disposable.hpp>
14#include <rpp/disposables/interface_disposable.hpp>
15
16namespace rpp
17{
19 {
20 virtual void add(disposable_wrapper disposable) = 0;
21
22 template<rpp::constraint::is_nothrow_invocable Fn>
23 disposable_wrapper add(Fn&& invocable)
24 {
25 auto d = make_callback_disposable(std::forward<Fn>(invocable));
26 add(d);
27 return d;
28 }
29
30 virtual void remove(const disposable_wrapper& d) = 0;
31 // dispose all added disposables, clear container but not dispose original disposable
32 virtual void clear() = 0;
33 };
34} // namespace rpp
Definition interface_composite_disposable.hpp:19
Interface of disposable.
Definition interface_disposable.hpp:23