File SharedPtr.hpp

template<typename T>
class SharedCounter

Private Functions

inline SharedCounter(T *p)
inline ~SharedCounter()
inline void addSharedRef()
inline void addWeakRef()
inline bool releaseSharedRef()
inline bool releaseWeakRef()

Private Members

T *ptr
std::atomic<int> share_count
std::atomic<int> weak_count

Friends

friend class SharedPtr
friend class WeakPtr
template<typename T>
class SharedPtr

Public Functions

inline SharedPtr()
SharedPtr(std::nullptr_t)
inline explicit SharedPtr(T *rawPtr)
inline SharedPtr(const SharedPtr &sp)
template<typename TDerived, typename std::enable_if<std::is_base_of<T, TDerived>::value>::type* = nullptr>
inline SharedPtr(const SharedPtr<TDerived> &sp)
SharedPtr(const SharedCounter<T> &sp)
inline ~SharedPtr()
bool isUnique() const
int useCount() const
int weakCount() const
bool operator==(T *p)
inline T *get() const
inline operator T*() const
inline T &operator*() const
inline T *operator->() const
T &operator[](int) const
inline SharedPtr &operator=(const SharedPtr &other)
inline void reset()
WeakPtr<T> createWeakPtr()

Public Static Functions

static const SharedPtr<T> &null()
template<typename ...Args>
static inline SharedPtr<T> make(Args&&... args)

Private Members

SharedCounter<T> *pc

Friends

friend class WeakPtr
template<typename T>
class WeakPtr

Public Functions

inline WeakPtr()
inline WeakPtr(std::nullptr_t)
inline WeakPtr(const SharedPtr<T> &sp)
inline WeakPtr(const WeakPtr &wp)
template<typename TDerived, typename std::enable_if<std::is_base_of<T, TDerived>::value>::type* = nullptr>
inline WeakPtr(const WeakPtr<TDerived> &sp)
inline ~WeakPtr()
inline WeakPtr &operator=(const WeakPtr &other)
inline WeakPtr &operator=(const SharedPtr<T> &other)
int useCount() const
int weakCount() const
inline bool isNull() const
inline bool operator==(T *p)
inline T *get() const
inline operator T*() const
inline T &operator*() const
inline T *operator->() const
T &operator[](int) const
inline void reset()

Public Static Functions

static inline const WeakPtr<T> &null()

Private Members

SharedCounter<T> *pc

Friends

friend class SharedPtr