|
(Note that these are not member functions.)
|
template<class T , class... Ts> |
IntrusivePtr< T > | make_intrusive (Ts &&... args) |
|
template<class T > |
bool | operator== (const IntrusivePtr< T > &x, std::nullptr_t) |
|
template<class T > |
bool | operator== (std::nullptr_t, const IntrusivePtr< T > &x) |
|
template<class T > |
bool | operator!= (const IntrusivePtr< T > &x, std::nullptr_t) |
|
template<class T > |
bool | operator!= (std::nullptr_t, const IntrusivePtr< T > &x) |
|
template<class T > |
bool | operator== (const IntrusivePtr< T > &x, const T *y) |
|
template<class T > |
bool | operator== (const T *x, const IntrusivePtr< T > &y) |
|
template<class T > |
bool | operator!= (const IntrusivePtr< T > &x, const T *y) |
|
template<class T > |
bool | operator!= (const T *x, const IntrusivePtr< T > &y) |
|
template<class T , class U > |
auto | operator== (const IntrusivePtr< T > &x, const IntrusivePtr< U > &y) -> decltype(x.get()==y.get()) |
|
template<class T , class U > |
auto | operator!= (const IntrusivePtr< T > &x, const IntrusivePtr< U > &y) -> decltype(x.get() !=y.get()) |
|
template<class T>
class hilti::rt::IntrusivePtr< T >
An intrusive, reference counting smart pointer implementation. Much like std::shared_ptr
, this smart pointer models shared ownership of an object through a pointer. Several IntrusivePtr
instances may point to the same object.
The IntrusivePtr
requires two free functions associated to T
that must be available via argument-dependent lookup: Ref
and Unref
. The former increments the reference by one whenever a new owner participates in the lifetime of the shared object and the latter decrements the reference count by one. Once the reference count reaches zero, Unref
also is responsible for destroying the shared object.
The IntrusivePtr
works with any type that offers the two free functions, but most notably can be used with classes derived from #intrusive_ptr::ManagedObject, which provides the functions.