Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Types | Public Member Functions | Static Public Member Functions | Friends
c10::intrusive_ptr< TTarget, NullType > Class Template Referencefinal

Public Types

using element_type = TTarget
 

Public Member Functions

 intrusive_ptr (intrusive_ptr &&rhs) noexcept
 
template<class From , class FromNullType >
 intrusive_ptr (intrusive_ptr< From, FromNullType > &&rhs) noexcept
 
 intrusive_ptr (const intrusive_ptr &rhs)
 
template<class From , class FromNullType >
 intrusive_ptr (const intrusive_ptr< From, FromNullType > &rhs)
 
intrusive_ptroperator= (intrusive_ptr &&rhs)&noexcept
 
template<class From , class FromNullType >
intrusive_ptroperator= (intrusive_ptr< From, FromNullType > &&rhs)&noexcept
 
intrusive_ptroperator= (const intrusive_ptr &rhs)&noexcept
 
template<class From , class FromNullType >
intrusive_ptroperator= (const intrusive_ptr< From, NullType > &rhs)&
 
TTarget * get () const noexcept
 
const TTarget & operator* () const noexcept
 
TTarget & operator* () noexcept
 
const TTarget * operator-> () const noexcept
 
TTarget * operator-> () noexcept
 
 operator bool () const noexcept
 
void reset () noexcept
 
void swap (intrusive_ptr &rhs) noexcept
 
bool defined () const noexcept
 
size_t use_count () const noexcept
 
size_t weak_use_count () const noexcept
 
bool unique () const noexcept
 
TTarget * release () noexcept
 Returns an owning (!) pointer to the underlying object and makes the intrusive_ptr instance invalid. More...
 

Static Public Member Functions

static intrusive_ptr reclaim (TTarget *owning_ptr)
 Takes an owning pointer to TTarget* and creates an intrusive_ptr that takes over ownership. More...
 
template<class... Args>
static intrusive_ptr make (Args &&...args)
 
static intrusive_ptr unsafe_reclaim_from_nonowning (TTarget *raw_ptr)
 Turn a non-owning raw pointer to an intrusive_ptr. More...
 

Friends

template<class TTarget2 , class NullType2 >
class intrusive_ptr
 
class weak_intrusive_ptr< TTarget, NullType >
 

Detailed Description

template<class TTarget, class NullType = detail::intrusive_target_default_null_type<TTarget>>
class c10::intrusive_ptr< TTarget, NullType >

Definition at line 149 of file intrusive_ptr.h.

Member Function Documentation

template<class TTarget, class NullType = detail::intrusive_target_default_null_type<TTarget>>
static intrusive_ptr c10::intrusive_ptr< TTarget, NullType >::reclaim ( TTarget *  owning_ptr)
inlinestatic

Takes an owning pointer to TTarget* and creates an intrusive_ptr that takes over ownership.

That means the refcount is not increased. This is the counter-part to intrusive_ptr::release() and the pointer passed in must have been created using intrusive_ptr::release().

Definition at line 346 of file intrusive_ptr.h.

template<class TTarget, class NullType = detail::intrusive_target_default_null_type<TTarget>>
TTarget* c10::intrusive_ptr< TTarget, NullType >::release ( )
inlinenoexcept

Returns an owning (!) pointer to the underlying object and makes the intrusive_ptr instance invalid.

That means the refcount is not decreased. You must put the returned pointer back into a intrusive_ptr using intrusive_ptr::reclaim(ptr) to properly destruct it. This is helpful for C APIs.

Definition at line 334 of file intrusive_ptr.h.

template<class TTarget, class NullType = detail::intrusive_target_default_null_type<TTarget>>
static intrusive_ptr c10::intrusive_ptr< TTarget, NullType >::unsafe_reclaim_from_nonowning ( TTarget *  raw_ptr)
inlinestatic

Turn a non-owning raw pointer to an intrusive_ptr.

This method is potentially dangerous (as it can mess up refcount).

Definition at line 371 of file intrusive_ptr.h.


The documentation for this class was generated from the following file: