Compare commits
2 Commits
7d5316bd79
...
27420c507d
| Author | SHA1 | Date | |
|---|---|---|---|
| 27420c507d | |||
| 93527f8647 |
@ -113,7 +113,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
rcp(rcp<U> && other) : ptr(static_cast<T *>(other.ptr))
|
||||
rcp(rcp<U> && other) noexcept : ptr(static_cast<T *>(other.ptr))
|
||||
{
|
||||
static_assert(std::is_base_of<T, U>::value, "rcp: implicit cast must be an upcast");
|
||||
other.ptr = nullptr;
|
||||
@ -275,7 +275,8 @@ rcp<T> rcp_dynamic_cast(rcp<U> && other)
|
||||
}
|
||||
|
||||
#define rcp_managed_root(classname) \
|
||||
public: \
|
||||
private: \
|
||||
mutable std::atomic<int> ref_count{0}; \
|
||||
void rcp_inc() const \
|
||||
{ \
|
||||
ref_count.fetch_add(1, std::memory_order_relaxed); \
|
||||
@ -291,8 +292,7 @@ rcp<T> rcp_dynamic_cast(rcp<U> && other)
|
||||
{ \
|
||||
return ref_count.load(std::memory_order_relaxed); \
|
||||
} \
|
||||
private: \
|
||||
mutable std::atomic<int> ref_count{0}; \
|
||||
template <typename T> friend class rcp; \
|
||||
rcp_managed(classname)
|
||||
|
||||
#define rcp_managed(classname) \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user