ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
Loading...
Searching...
No Matches
interface_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/AlexInLog/ReactivePlusPlus
9
//
10
11
#pragma once
12
13
#include <rpp/disposables/fwd.hpp>
14
15
namespace
rpp
16
{
22
struct
interface_disposable
23
{
24
virtual
~interface_disposable
()
noexcept
=
default
;
25
30
virtual
bool
is_disposed
() const noexcept = 0;
31
36
void
dispose
() noexcept { dispose_impl(Mode::Disposing); }
37
38
template
<rpp::constra
int
::decayed_type TStrategy>
39
friend
class
rpp::details::auto_dispose_wrapper
;
40
41
protected
:
42
enum class
Mode :
bool
43
{
44
Disposing = 0,
// someone called "dispose" method manually
45
Destroying = 1
// called during destruction -> not needed to clear self in other disposables and etc + not allowed to call `shared_from_this`
46
};
47
48
virtual
void
dispose_impl(Mode mode)
noexcept
= 0;
49
};
50
}
// namespace rpp
rpp::details::auto_dispose_wrapper
Definition
disposable_wrapper.hpp:29
rpp::interface_disposable
Interface of disposable.
Definition
interface_disposable.hpp:23
rpp::interface_disposable::is_disposed
virtual bool is_disposed() const noexcept=0
Check if this disposable is just disposed.
rpp::interface_disposable::dispose
void dispose() noexcept
Dispose disposable and free any underlying resources and etc.
Definition
interface_disposable.hpp:36
src
rpp
rpp
disposables
interface_disposable.hpp
Generated by
1.17.0