summaryrefslogtreecommitdiffhomepage
path: root/compat/borrowed-ptr.cpp
blob: f6f098fa4fe46c711fb3f63b79db914d2e7ba917 (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
#include "borrowed-ptr.inl"

namespace floormat::detail_bptr {

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;
}

} // namespace floormat::detail_bptr

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