blob: da5c6a720265e1b8d22ce1967cd5870dea730f31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include "borrowed-ptr.inl"
#include "compat/assert.hpp"
namespace floormat::detail_borrowed_ptr {
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdelete-abstract-non-virtual-dtor"
#elif defined __GNUG__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
#elif defined _MSC_VER
#pragma warning(push)
#pragma warning(disable : 5205)
#endif
void control_block::decrement(control_block*& blk) noexcept
{
auto c = --blk->_count;
fm_bptr_assert(c != (uint32_t)-1);
if (c == 0)
{
delete blk->_ptr;
delete blk;
}
blk = nullptr;
//blk = (control_block*)-1;
}
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined __GNUG__
#pragma GCC diagnostic pop
#elif defined _MSC_VER
#pragma warning(pop)
#endif
} // namespace floormat::detail_borrowed_ptr
namespace floormat {
bptr_base::~bptr_base() noexcept = default;
bptr_base::bptr_base() noexcept = default;
bptr_base::bptr_base(const bptr_base&) noexcept = default;
bptr_base::bptr_base(bptr_base&&) noexcept = default;
bptr_base& bptr_base::operator=(const bptr_base&) noexcept = default;
bptr_base& bptr_base::operator=(bptr_base&&) noexcept = default;
} // namespace floormat
|