Compare commits

..

No commits in common. "27420c507d0b4cf970137e18d309ddef3a002841" and "7d5316bd79cc720f8c35694cc6443563f304789c" have entirely different histories.

View File

@ -113,7 +113,7 @@ public:
} }
template <typename U> template <typename U>
rcp(rcp<U> && other) noexcept : ptr(static_cast<T *>(other.ptr)) rcp(rcp<U> && other) : ptr(static_cast<T *>(other.ptr))
{ {
static_assert(std::is_base_of<T, U>::value, "rcp: implicit cast must be an upcast"); static_assert(std::is_base_of<T, U>::value, "rcp: implicit cast must be an upcast");
other.ptr = nullptr; other.ptr = nullptr;
@ -275,8 +275,7 @@ rcp<T> rcp_dynamic_cast(rcp<U> && other)
} }
#define rcp_managed_root(classname) \ #define rcp_managed_root(classname) \
private: \ public: \
mutable std::atomic<int> ref_count{0}; \
void rcp_inc() const \ void rcp_inc() const \
{ \ { \
ref_count.fetch_add(1, std::memory_order_relaxed); \ ref_count.fetch_add(1, std::memory_order_relaxed); \
@ -292,7 +291,8 @@ rcp<T> rcp_dynamic_cast(rcp<U> && other)
{ \ { \
return ref_count.load(std::memory_order_relaxed); \ return ref_count.load(std::memory_order_relaxed); \
} \ } \
template <typename T> friend class rcp; \ private: \
mutable std::atomic<int> ref_count{0}; \
rcp_managed(classname) rcp_managed(classname)
#define rcp_managed(classname) \ #define rcp_managed(classname) \