summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/borrowed-ptr-fwd.hpp2
-rw-r--r--compat/borrowed-ptr.inl9
2 files changed, 8 insertions, 3 deletions
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<typename U, typename Tʹ> friend bptr<U> static_pointer_cast(const bptr<Tʹ>& p) noexcept;
};
+template<typename T> bptr(T* ptr) -> bptr<T>;
+
} // 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<T>& bptr<T>::_copy_assign(const bptr<Y>& 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<T>& bptr<T>::_move_assign(bptr<Y>&& other) noexcept
template<typename T> T* bptr<T>::get() const noexcept
{
- if (blk && blk->_ptr)
+ if (blk && blk->_ptr) [[likely]]
{
fm_bptr_assert(casted_ptr);
return casted_ptr;