actor-framework
Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
caf::intrusive_cow_ptr< T > Class Template Reference

An intrusive, reference counting smart pointer implementation with copy-on-write optimization. More...

#include <intrusive_cow_ptr.hpp>

Inheritance diagram for caf::intrusive_cow_ptr< T >:
Inheritance graph
[legend]
Collaboration diagram for caf::intrusive_cow_ptr< T >:
Collaboration graph
[legend]

Public Types

using pointer = T *
 
using const_pointer = const T *
 
using element_type = T
 
using reference = T &
 
using const_reference = const T &
 
using counting_pointer = intrusive_ptr< T >
 

Public Member Functions

 intrusive_cow_ptr (intrusive_cow_ptr &&) noexcept=default
 
 intrusive_cow_ptr (const intrusive_cow_ptr &) noexcept=default
 
 intrusive_cow_ptr (std::nullptr_t) noexcept
 
template<class Y >
 intrusive_cow_ptr (intrusive_cow_ptr< Y > other) noexcept
 
 intrusive_cow_ptr (counting_pointer p) noexcept
 
 intrusive_cow_ptr (pointer ptr, bool add_ref=true) noexcept
 
intrusive_cow_ptroperator= (intrusive_cow_ptr &&) noexcept=default
 
intrusive_cow_ptroperator= (const intrusive_cow_ptr &) noexcept=default
 
intrusive_cow_ptroperator= (counting_pointer x) noexcept
 
template<class U = T, class... Ts>
void emplace (Ts &&... xs)
 
ptrdiff_t compare (std::nullptr_t) const noexcept
 
ptrdiff_t compare (const_pointer ptr) const noexcept
 
ptrdiff_t compare (const counting_pointer &other) const noexcept
 
ptrdiff_t compare (const intrusive_cow_ptr &other) const noexcept
 
void swap (intrusive_cow_ptr &other) noexcept
 Swaps the managed object with other.
 
void reset (pointer p=nullptr, bool add_ref=true) noexcept
 Replaces the managed object.
 
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 unshare ()
 Forces a copy of the managed object unless it already has a reference count of exactly 1. More...
 
pointer unshared_ptr ()
 Returns a mutable pointer to the managed object.
 
reference unshared ()
 Returns a mutable reference to the managed object.
 
const_pointer get () const noexcept
 Returns a read-only pointer to the managed object.
 
const counting_pointercounting_ptr () const noexcept
 Returns the intrusive pointer managing the object.
 
const_pointer operator-> () const noexcept
 Returns a read-only pointer to the managed object.
 
const_reference operator* () const noexcept
 Returns a read-only reference to the managed object.
 
 operator bool () const noexcept
 
template<class C >
intrusive_cow_ptr< C > downcast () const noexcept
 
template<class C >
intrusive_cow_ptr< C > upcast () const noexcept
 

Static Public Member Functions

template<class... Ts>
static intrusive_cow_ptr make (Ts &&... xs)
 Constructs an object of type T in an intrusive_cow_ptr.
 

Related Functions

(Note that these are not member functions.)

template<class T >
T * default_intrusive_cow_ptr_unshare (T *&ptr)
 Default implementation for unsharing values.
 
template<class T >
T * intrusive_cow_ptr_unshare (T *&ptr)
 Customization point for allowing intrusive_cow_ptr<T> with a forward declared T.
 
template<class T >
std::string to_string (const intrusive_cow_ptr< T > &x)
 

Detailed Description

template<class T>
class caf::intrusive_cow_ptr< T >

An intrusive, reference counting smart pointer implementation with copy-on-write optimization.

Member Function Documentation

◆ detach()

template<class T>
pointer caf::intrusive_cow_ptr< T >::detach ( )
inlinenoexcept

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

◆ release()

template<class T>
pointer caf::intrusive_cow_ptr< T >::release ( )
inlinenoexcept

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

◆ unshare()

template<class T>
void caf::intrusive_cow_ptr< T >::unshare ( )
inline

Forces a copy of the managed object unless it already has a reference count of exactly 1.

Friends And Related Function Documentation

◆ to_string()

template<class T >
std::string to_string ( const intrusive_cow_ptr< T > &  x)
related

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