112 other.controlBlock =
nullptr;
117 if (
this != &other) {
119 this->
ptr = other.ptr;
122 other.controlBlock =
nullptr;
128 template <typename U, typename = std::enable_if_t<std::is_base_of<T, U>::value>>
135 template <
typename U>
137 static_assert(std::is_base_of<T, U>::value,
"T must be a base class of U");
138 if (
this !=
reinterpret_cast<const RefPtr*
>(&other)) {
158 void reset(T* newPtr =
nullptr)
override {
RefPtr(RefPtr &&other) noexcept
RefPtr & operator=(std::nullptr_t) noexcept
RefPtr(const RefPtr< U > &other)
RefPtr & operator=(RefPtr &&other) noexcept
SharedControlBlock * controlBlock
RefPtr(const RefPtr &other)
void reset(T *newPtr=nullptr) override
RefPtr & operator=(const RefPtr< U > &other)
RefPtr & operator=(const RefPtr &other)
SharedControlBlock * getControlBlock() const
void release()
Drops one reference, deleting the object and control block at zero.
SmartPointer(T *p=nullptr)
Root namespace for everything the engine exposes.
std::atomic< size_t > refCount
Number of RefPtr instances currently owning the object.