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

Public Types

using element_type = TTarget
 

Public Member Functions

 weak_intrusive_ptr (const intrusive_ptr< TTarget, NullType > &ptr)
 
 weak_intrusive_ptr (weak_intrusive_ptr &&rhs) noexcept
 
template<class From , class FromNullType >
 weak_intrusive_ptr (weak_intrusive_ptr< From, FromNullType > &&rhs) noexcept
 
 weak_intrusive_ptr (const weak_intrusive_ptr &rhs)
 
template<class From , class FromNullType >
 weak_intrusive_ptr (const weak_intrusive_ptr< From, FromNullType > &rhs)
 
weak_intrusive_ptroperator= (weak_intrusive_ptr &&rhs)&noexcept
 
template<class From , class FromNullType >
weak_intrusive_ptroperator= (weak_intrusive_ptr< From, FromNullType > &&rhs)&noexcept
 
weak_intrusive_ptroperator= (const weak_intrusive_ptr &rhs)&noexcept
 
template<class From , class FromNullType >
weak_intrusive_ptroperator= (const weak_intrusive_ptr< From, NullType > &rhs)&
 
void reset () noexcept
 
void swap (weak_intrusive_ptr &rhs) noexcept
 
TTarget * _unsafe_get_target () const noexcept
 
size_t use_count () const noexcept
 
size_t weak_use_count () const noexcept
 
bool expired () const noexcept
 
intrusive_ptr< TTarget, NullType > lock () const noexcept
 
TTarget * release () noexcept
 Returns an owning (but still only weakly referenced) pointer to the underlying object and makes the weak_intrusive_ptr instance invalid. More...
 

Static Public Member Functions

static weak_intrusive_ptr reclaim (TTarget *owning_weak_ptr)
 Takes an owning (but must be weakly referenced) pointer to TTarget* and creates a weak_intrusive_ptr that takes over ownership. More...
 

Friends

template<class TTarget2 , class NullType2 >
class weak_intrusive_ptr
 
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 >
bool operator< (const weak_intrusive_ptr< TTarget1, NullType1 > &lhs, const weak_intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept
 
template<class TTarget1 , class NullType1 , class TTarget2 , class NullType2 >
bool operator== (const weak_intrusive_ptr< TTarget1, NullType1 > &lhs, const weak_intrusive_ptr< TTarget2, NullType2 > &rhs) noexcept
 

Detailed Description

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

Definition at line 144 of file intrusive_ptr.h.

Member Function Documentation

template<typename TTarget, class NullType = detail::intrusive_target_default_null_type<TTarget>>
static weak_intrusive_ptr c10::weak_intrusive_ptr< TTarget, NullType >::reclaim ( TTarget *  owning_weak_ptr)
inlinestatic

Takes an owning (but must be weakly referenced) pointer to TTarget* and creates a weak_intrusive_ptr that takes over ownership.

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

Definition at line 619 of file intrusive_ptr.h.

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

Returns an owning (but still only weakly referenced) pointer to the underlying object and makes the weak_intrusive_ptr instance invalid.

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

Definition at line 606 of file intrusive_ptr.h.


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