12#ifndef ROC_CORE_SHARED_PTR_H_
13#define ROC_CORE_SHARED_PTR_H_
31template <
class T,
template <
class TT>
class OwnershipPolicy = RefCountedOwnership>
100 roc_panic(
"shared ptr: attempt to dereference null pointer");
108 roc_panic(
"shared ptr: attempt to dereference null pointer");
127 OwnershipPolicy<T>::release(*ptr_);
135template <
class T1,
class T2>
141template <
class T1,
class T2>
Shared ownership intrusive pointer.
SharedPtr(const SharedPtr< TT, OwnershipPolicy > &other)
Create shared pointer from shared pointer of another type.
~SharedPtr()
Destroy shared pointer.
T * get() const
Get underlying pointer.
SharedPtr(const SharedPtr &other)
Create shared pointer from shared pointer of the same type.
void reset(T *ptr=NULL)
Reset shared pointer and attach it to another object.
void reset(const SharedPtr &other)
Reset shared pointer and attach it to another object.
SharedPtr & operator=(const SharedPtr &other)
Reset shared pointer and attach it to another object.
T * operator->() const
Get underlying pointer.
SharedPtr()
Create empty shared pointer.
SharedPtr(T *ptr)
Create shared pointer from raw pointer.
T & operator*() const
Get underlying reference.
bool operator!=(const SharedPtr< T1 > &a, const SharedPtr< T2 > &b)
Equality check.
bool operator==(const SharedPtr< T1 > &a, const SharedPtr< T2 > &b)
Equality check.
#define roc_panic(...)
Print error message and terminate program gracefully.
Commonly used types and functions.