56template<
typename T>
class RefPtr;
111 : instance_(other.instance_)
122 : instance_(other.instance_)
150 T* old_value = std::move(instance_);
151 instance_ = std::forward<T*>(
nullptr);
153 old_value->Release();
159 inline T*
get()
const {
return instance_; }
162 T* result = std::move(instance_);
163 instance_ = std::forward<T*>(
nullptr);
167 T&
operator*()
const { assert(instance_);
return *instance_; }
184 return a.instance_ == b.instance_;
188 return a.instance_ != b.instance_;
192 return a.instance_ < b.instance_;
212 friend RefPtr AdoptRef<T>(T&);
249 T* old_instance = std::move(instance_);
250 instance_ = std::forward<T*>(
nullptr);
252 old_instance->Release();
259 RefPtr ptr = std::move(other);
268 RefPtr ptr = std::move(other);
280 std::swap(instance_, other.instance_);
289template<
typename T,
typename U>
292 return a.
get() == b.
get();
295template<
typename T,
typename U>
301template<
typename T,
typename U>
307template<
typename T,
typename U>
310 return a.
get() != b.
get();
313template<
typename T,
typename U>
319template<
typename T,
typename U>
#define UExport
Definition Defines.h:65
Interface for all ref-counted objects that will be managed using the RefPtr<> smart pointer.
Definition RefPtr.h:47
virtual void AddRef() const =0
virtual int ref_count() const =0
virtual void Release() const =0
A nullable smart pointer.
Definition RefPtr.h:79
RefPtr(RefPtr< U > &&other)
Move constructor.
Definition RefPtr.h:140
RefPtr(const RefPtr &other)
Copy constructor.
Definition RefPtr.h:110
~RefPtr()
Destroy RefPtr (wll decrement ref-count by one)
Definition RefPtr.h:148
friend bool operator==(const RefPtr &a, const RefPtr &b)
Definition RefPtr.h:183
T * get() const
Get a pointer to wrapped object.
Definition RefPtr.h:159
bool operator!() const
Definition RefPtr.h:170
void swap(RefPtr &ptr)
Exchanges the stored pointer values and the ownerships of *this and ptr.
Definition RefPtr.h:278
RefPtr & operator=(const RefPtr &)
Definition RefPtr.h:222
T * LeakRef()
Definition RefPtr.h:161
T & operator*() const
Definition RefPtr.h:167
AdoptTag
Definition RefPtr.h:214
@ Adopt
Definition RefPtr.h:214
constexpr RefPtr()
Construct a NULL ref-pointer.
Definition RefPtr.h:84
friend bool operator!=(const RefPtr &a, const RefPtr &b)
Definition RefPtr.h:187
RefPtr(T *other)
Construct from a pointer.
Definition RefPtr.h:100
T *RefPtr::* UnspecifiedBoolType
Definition RefPtr.h:173
void reset()
Releases the ownership of the managed object, if any.
Definition RefPtr.h:273
RefPtr & operator=(RefPtr< U > &&)
friend bool operator<(const RefPtr &a, const RefPtr &b)
Definition RefPtr.h:191
RefPtr(RefPtr &&other)
Move constructor.
Definition RefPtr.h:131
RefPtr(const RefPtr< U > &other)
Copy constructor with internal type conversion.
Definition RefPtr.h:121
RefPtr & operator=(const RefPtr< U > &)
RefPtr(T &object, AdoptTag)
Definition RefPtr.h:215
RefPtr(std::nullptr_t)
Construct a NULL ref-pointer.
Definition RefPtr.h:92
T * operator->() const
Definition RefPtr.h:168
RefPtr< T > AdoptRef(T &reference)
Helper for wrapping new objects with the RefPtr smart pointer.
Definition RefPtr.h:68
bool operator!=(const Matrix &a, const Matrix &b)
void swap(RefPtr< T > &a, RefPtr< T > &b)
Definition RefPtr.h:284
bool operator==(const Matrix &a, const Matrix &b)