3#include <Foundation/Types/RefCounted.h>
4#include <Foundation/Types/UniquePtr.h>
12 PL_DECLARE_MEM_RELOCATABLE_TYPE();
82 operator const T*()
const;
88 explicit operator bool()
const;
100 bool operator!=(std::nullptr_t)
const;
101 bool operator<(std::nullptr_t)
const;
102 bool operator<=(std::nullptr_t)
const;
103 bool operator>(std::nullptr_t)
const;
104 bool operator>=(std::nullptr_t)
const;
109 template <
typename DERIVED>
116 template <
typename U>
119 void AddReferenceIfValid();
120 void ReleaseReferenceIfValid();
126#include <Foundation/Types/Implementation/SharedPtr_inl.h>
Base class for all memory allocators.
Definition Allocator.h:23
A Shared ptr manages a shared object and destroys that object when no one references it anymore....
Definition SharedPtr.h:10
plSharedPtr< DERIVED > Downcast() const
Returns a copy of this, as an plSharedPtr<DERIVED>. Downcasts the stored pointer (using static_cast).
Definition SharedPtr.h:110
void Clear()
Destroys the managed object if no one else references it anymore and resets the shared ptr.
Definition SharedPtr_inl.h:174
plSharedPtr< T > & operator=(plUniquePtr< U > &&other)
Move assigns a shared ptr from a unique ptr. The unique ptr will be empty afterwards.
plSharedPtr(const plSharedPtr< U > &other)
Copy constructs a shared ptr from another. Both will hold a reference to the managed object afterward...
T * operator->() const
Provides access to the managed object.
Definition SharedPtr_inl.h:186
plSharedPtr< T > & operator=(const plInternal::NewInstance< U > &instance)
Sets the shared ptr from a freshly created instance through PL_NEW or PL_DEFAULT_NEW.
bool operator==(const plSharedPtr< T > &rhs) const
Compares the shared ptr against another shared ptr.
Definition SharedPtr_inl.h:210
T * Borrow() const
Borrows the managed object. The shared ptr stays unmodified.
Definition SharedPtr_inl.h:168
plSharedPtr(const plInternal::NewInstance< U > &instance)
Creates a shared ptr from a freshly created instance through PL_NEW or PL_DEFAULT_NEW.
plSharedPtr(U *pInstance, plAllocator *pAllocator)
Creates a shared ptr from a pointer and an allocator. The passed allocator will be used to destroy th...
T & operator*() const
Provides access to the managed object.
Definition SharedPtr_inl.h:180
~plSharedPtr()
Destroys the managed object using the stored allocator if no one else references it anymore.
Definition SharedPtr_inl.h:76
plSharedPtr(plUniquePtr< U > &&other)
Move constructs a shared ptr from a unique ptr. The unique ptr will be empty afterwards.
plSharedPtr< T > & operator=(plSharedPtr< U > &&other)
Move assigns a shared ptr from another. The other shared ptr will be empty afterwards.
plSharedPtr< T > & operator=(const plSharedPtr< U > &other)
Sets the shared ptr from another. Both will hold a reference to the managed object afterwards.
plSharedPtr(plSharedPtr< U > &&other)
Move constructs a shared ptr from another. The other shared ptr will be empty afterwards.
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
Definition Allocator_inl.h:18