Combined intrusive/non-intrusive smart pointer. Can reference and share any object automatically.
More...
|
| SharedPtr () |
|
| SharedPtr (nullptr_t) |
|
template<class U , typename std::enable_if< mt::True< U >::value &&isIntrusive, int >::type = 0> |
| SharedPtr (U *ptr) |
| Reference an object, allowing for implicit construction. For intrusive pointers only. More...
|
|
template<class U , class Fin = finalize<U>, class Alloc = typename DefaultAllocator<U>::type, typename mt::disable_if< mt::True< U >::value &&isIntrusive, int >::type = 0> |
| SharedPtr (U *ptr, Fin &&f=Fin(), Alloc &&a=Alloc()) |
| Reference an object with finalizer and internal control block allocator. For non-intrusive pointers only. More...
|
|
| SharedPtr (const SharedPtr &ptr) |
| Reference the object pointed to by another shared pointer. More...
|
|
template<class U > |
| SharedPtr (const SharedPtr< U > &ptr) |
|
| SharedPtr (SharedPtr &&ptr) |
| Transfer ownership out of shared pointer, leaving it null. More...
|
|
template<class U > |
| SharedPtr (SharedPtr< U > &&ptr) |
|
template<class U > |
| SharedPtr (const WeakPtr< U > &ptr) |
| Lock a weak pointer to get access to its object. Shared ptr will be null if the object has already been destroyed. More...
|
|
template<class U , class Fin > |
| SharedPtr (UniquePtr< U, Fin > &&ptr) |
| Transfer ownership out of unique pointer, leaving it null. More...
|
|
| ~SharedPtr () |
|
SharedPtr & | operator= (const SharedPtr &rhs) |
|
template<class U > |
SharedPtr & | operator= (const SharedPtr< U > &rhs) |
|
SharedPtr & | operator= (SharedPtr &&rhs) |
|
template<class U > |
SharedPtr & | operator= (SharedPtr< U > &&rhs) |
|
template<class U , class Fin , typename std::enable_if< mt::True< U >::value &&isIntrusive, int >::type = 0> |
SharedPtr & | operator= (UniquePtr< U, Fin > &&rhs) |
|
template<class U , class Fin , typename mt::disable_if< mt::True< U >::value &&isIntrusive, int >::type = 0> |
SharedPtr & | operator= (UniquePtr< U, Fin > &&rhs) |
|
template<class U > |
bool | operator== (const SharedPtr< U > &rhs) const |
|
template<class U > |
bool | operator!= (const SharedPtr< U > &rhs) const |
|
template<class U > |
bool | operator< (const SharedPtr< U > &rhs) const |
|
template<class U > |
bool | operator> (const SharedPtr< U > &rhs) const |
|
template<class U > |
bool | operator<= (const SharedPtr< U > &rhs) const |
|
template<class U > |
bool | operator>= (const SharedPtr< U > &rhs) const |
|
bool | operator== (nullptr_t) const |
|
bool | operator!= (nullptr_t) const |
|
T * | operator-> () const |
|
Ref | operator* () const |
|
| operator T * () const |
|
T * | get () const |
| Get the raw pointer to the object. More...
|
|
template<class U , typename std::enable_if< mt::True< U >::value &&isIntrusive, int >::type = 0> |
void | set (U *ptr) |
| Dereference the current object and reference a new object. For intrusive pointers only. More...
|
|
template<class U , class Fin = finalize<U>, class Alloc = typename DefaultAllocator<U>::type, typename mt::disable_if< mt::True< U >::value &&isIntrusive, int >::type = 0> |
void | set (U *ptr, Fin &&f=Fin(), Alloc &&a=Alloc()) |
| Dereference the current object and reference a new object, with finalizer and internal control block allocator. For non-intrusive pointers only. More...
|
|
void | set (nullptr_t) |
|
int | refCount () const |
| Get number of shared references to the object. More...
|
|
bool | unique () const |
| Check whether this is the only shared reference to the object. More...
|
|
|
(Note that these are not member functions.)
|
template<class T , class Alloc , class... Args, typename mt::disable_if< mt::is_base_of< priv::SharedObj_tag, T >::value, int >::type = 0> |
SharedPtr< T > | alloc_shared (Alloc &&a, Args &&...args) |
| Create a shared ptr to an object of type T constructed with args. The object and the internal control block are allocated together in a single allocation. More...
|
|
template<class T , class Alloc , class... Args, typename std::enable_if< mt::is_base_of< priv::SharedObj_tag, T >::value, int >::type = 0> |
SharedPtr< T > | alloc_shared (Alloc &&a, Args &&...args) |
| Specializaton for intrusive pointers, simply allocates T and constructs with args. More...
|
|
template<class T , class... Args, class Alloc = typename DefaultAllocator<T>::type> |
SharedPtr< T > | make_shared (Args &&...args) |
| alloc_shared() using T::Allocator if available, otherwise std::allocator More...
|
|
template<class T , class U > |
SharedPtr< T > | static_pointer_cast (const SharedPtr< U > &rhs) |
|
template<class T , class U > |
SharedPtr< T > | dynamic_pointer_cast (const SharedPtr< U > &rhs) |
|
template<class T , class U > |
SharedPtr< T > | const_pointer_cast (const SharedPtr< U > &rhs) |
|
template<class T>
class honey::SharedPtr< T >
Combined intrusive/non-intrusive smart pointer. Can reference and share any object automatically.
Non-intrusive pointers use the finalizer and internal control block allocator supplied as arguments.
Intrusive pointers finalize with SharedObj::finalize() and don't require an internal control block allocator.
- See also
- SharedObj, WeakPtr
template<class T>
template<class U , class Fin = finalize<U>, class Alloc = typename DefaultAllocator<U>::type, typename mt::disable_if< mt::True< U >::value &&isIntrusive, int >::type = 0>
Reference an object with finalizer and internal control block allocator. For non-intrusive pointers only.
Finalizer is run when reference count reaches 0 (deletes object by default).