libcaf  0.15.0
Public Types | Public Member Functions | Static Public Attributes | Related Functions | List of all members
caf::weak_intrusive_ptr< T > Class Template Reference

An intrusive, reference counting smart pointer implementation. More...

#include <weak_intrusive_ptr.hpp>

Inherits comparable< weak_intrusive_ptr< T > >, comparable< weak_intrusive_ptr< T >, const T * >, and comparable< weak_intrusive_ptr< T >, std::nullptr_t >.

Public Types

using pointer = T *
 
using const_pointer = const T *
 
using element_type = T
 
using reference = T &
 
using const_reference = const T &
 

Public Member Functions

 weak_intrusive_ptr (pointer raw_ptr, bool add_ref=true)
 
 weak_intrusive_ptr (weak_intrusive_ptr &&other)
 
 weak_intrusive_ptr (const weak_intrusive_ptr &other)
 
template<class Y >
 weak_intrusive_ptr (weak_intrusive_ptr< Y > other)
 
void swap (weak_intrusive_ptr &other) noexcept
 
pointer detach () noexcept
 Returns the raw pointer without modifying reference count and sets this to nullptr. More...
 
pointer release () noexcept
 Returns the raw pointer without modifying reference count and sets this to nullptr. More...
 
void reset (pointer new_value=nullptr, bool add_ref=true)
 
weak_intrusive_ptroperator= (pointer ptr)
 
weak_intrusive_ptroperator= (weak_intrusive_ptr other)
 
pointer get () const
 
pointer operator-> () const
 
reference operator* () const
 
bool operator! () const
 
 operator bool () const
 
ptrdiff_t compare (const_pointer ptr) const
 
ptrdiff_t compare (const weak_intrusive_ptr &other) const
 
ptrdiff_t compare (std::nullptr_t) const
 
intrusive_ptr< T > lock () const
 Tries to upgrade this weak reference to a strong reference.
 
pointer get_locked () const
 Tries to upgrade this weak reference to a strong reference. More...
 

Static Public Attributes

static constexpr bool has_weak_ptr_semantics = true
 
static constexpr bool has_non_null_guarantee = false
 

Related Functions

(Note that these are not member functions.)

template<class X , typename Y >
bool operator== (const weak_intrusive_ptr< X > &lhs, const weak_intrusive_ptr< Y > &rhs)
 
template<class X , typename Y >
bool operator!= (const weak_intrusive_ptr< X > &lhs, const weak_intrusive_ptr< Y > &rhs)
 

Detailed Description

template<class T>
class caf::weak_intrusive_ptr< T >

An intrusive, reference counting smart pointer implementation.

Member Function Documentation

template<class T>
pointer caf::weak_intrusive_ptr< T >::detach ( )
noexcept

Returns the raw pointer without modifying reference count and sets this to nullptr.

template<class T>
pointer caf::weak_intrusive_ptr< T >::get_locked ( ) const

Tries to upgrade this weak reference to a strong reference.

Returns a pointer with increased strong reference count on success, nullptr otherwise.

template<class T>
pointer caf::weak_intrusive_ptr< T >::release ( )
noexcept

Returns the raw pointer without modifying reference count and sets this to nullptr.

Friends And Related Function Documentation

template<class X , typename Y >
bool operator!= ( const weak_intrusive_ptr< X > &  lhs,
const weak_intrusive_ptr< Y > &  rhs 
)
related
template<class X , typename Y >
bool operator== ( const weak_intrusive_ptr< X > &  lhs,
const weak_intrusive_ptr< Y > &  rhs 
)
related

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