From 965e81a6bfc1d91041d2af32bf459a76d8c42fc8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 May 2024 01:07:46 +0200 Subject: aa --- compat/borrowed-ptr-fwd.hpp | 2 ++ compat/borrowed-ptr.inl | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'compat') diff --git a/compat/borrowed-ptr-fwd.hpp b/compat/borrowed-ptr-fwd.hpp index 01dd20f7..28ea3c55 100644 --- a/compat/borrowed-ptr-fwd.hpp +++ b/compat/borrowed-ptr-fwd.hpp @@ -69,4 +69,6 @@ public: template friend bptr static_pointer_cast(const bptr& p) noexcept; }; +template bptr(T* ptr) -> bptr; + } // namespace floormat diff --git a/compat/borrowed-ptr.inl b/compat/borrowed-ptr.inl index 6b72192c..05724fcd 100644 --- a/compat/borrowed-ptr.inl +++ b/compat/borrowed-ptr.inl @@ -5,7 +5,9 @@ #define FM_BPTR_DEBUG -#if defined FM_BPTR_DEBUG && !defined FM_NO_DEBUG +#ifdef __CLION_IDE__ +#define fm_bptr_assert(...) (void(__VA_ARGS__)) +#elif defined FM_BPTR_DEBUG && !defined FM_NO_DEBUG #define fm_bptr_assert(...) fm_assert(__VA_ARGS__) #else #define fm_bptr_assert(...) void() @@ -175,7 +177,8 @@ bptr& bptr::_copy_assign(const bptr& other) noexcept blk->decrement(blk); casted_ptr = other.casted_ptr; blk = other.blk; - ++blk->_count; + if (blk) + ++blk->_count; } return *this; } @@ -204,7 +207,7 @@ bptr& bptr::_move_assign(bptr&& other) noexcept template T* bptr::get() const noexcept { - if (blk && blk->_ptr) + if (blk && blk->_ptr) [[likely]] { fm_bptr_assert(casted_ptr); return casted_ptr; -- cgit v1.2.3