From 9f13bacf281aa07da04c9709b62fe0dead21b2c8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 May 2024 23:23:38 +0200 Subject: a w --- compat/borrowed-ptr.inl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compat/borrowed-ptr.inl b/compat/borrowed-ptr.inl index 98e0fec5..6b72192c 100644 --- a/compat/borrowed-ptr.inl +++ b/compat/borrowed-ptr.inl @@ -92,7 +92,7 @@ bptr::bptr(T* ptr) noexcept: casted_ptr{ptr}, blk{detail_borrowed_ptr::control_block_impl::create(ptr)} { - fm_bptr_assert(blk && blk->_count == 1 && ptr && blk->_ptr); + fm_bptr_assert(!blk || blk->_count == 1 && blk->_ptr); } template @@ -142,8 +142,9 @@ template template void bptr::destroy() noexcept { - if constexpr(!MaybeEmpty) - fm_assert(blk); + if constexpr(MaybeEmpty) + if (!blk) + return; blk->free_ptr(); blk->_ptr = nullptr; casted_ptr = nullptr; @@ -219,7 +220,7 @@ template T* bptr::operator->() const noexcept } template T& bptr::operator*() const noexcept { return *operator->(); } -template bool operator==(const bptr& a, const bptr& b) noexcept { return a.blk == b.blk; } +template bool operator==(const bptr& a, const bptr& b) noexcept { return a.get() == b.get(); } template bptr::operator bool() const noexcept { return get(); } template -- cgit v1.2.3