SObjectizer 5.8
Loading...
Searching...
No Matches
so_5::intrusive_ptr_t< T > Class Template Reference

Template class for smart reference wrapper on the atomic_refcounted_t. More...

#include <atomic_refcounted.hpp>

Public Member Functions

 intrusive_ptr_t () noexcept
 Default constructor.
 
 intrusive_ptr_t (T *obj) noexcept
 Constructor for a raw pointer.
 
 intrusive_ptr_t (const intrusive_ptr_t &o) noexcept
 Copy constructor.
 
 intrusive_ptr_t (intrusive_ptr_t &&o) noexcept
 Move constructor.
 
template<class Y >
 intrusive_ptr_t (const intrusive_ptr_t< Y > &o) noexcept
 Constructor from another smart reference.
 
template<class Y >
 intrusive_ptr_t (std::unique_ptr< Y > o) noexcept
 Constructor from unique_ptr instance.
 
 ~intrusive_ptr_t () noexcept
 Destructor.
 
intrusive_ptr_toperator= (const intrusive_ptr_t &o) noexcept
 Copy operator.
 
intrusive_ptr_toperator= (intrusive_ptr_t &&o) noexcept
 Move operator.
 
void reset () noexcept
 Drop controlled object.
 
template<class Y >
intrusive_ptr_t< Y > make_reference () const noexcept
 Make reference with casing to different type.
 
 operator bool () const noexcept
 Is this a null reference?
 
Access to object.
T * get () const noexcept
 
T * operator-> () const noexcept
 
T & operator* () const noexcept
 
Comparision
bool operator== (const intrusive_ptr_t &o) const
 
bool operator< (const intrusive_ptr_t &o) const
 

Private Member Functions

void take_object () noexcept
 Increment reference count to object if it's not null.
 
void dismiss_object () noexcept
 Decrement reference count to object and delete it if needed.
 

Static Private Member Functions

static void ensure_right_T ()
 

Private Attributes

T * m_obj
 Object controlled by a smart reference.
 

Friends

void swap (intrusive_ptr_t &a, intrusive_ptr_t &b) noexcept
 Swap values.
 

Detailed Description

template<class T>
class so_5::intrusive_ptr_t< T >

Template class for smart reference wrapper on the atomic_refcounted_t.

Since
v.5.2.0
Template Parameters
Tclass which must be derived from the atomic_refcounted_t.

Definition at line 92 of file atomic_refcounted.hpp.

Constructor & Destructor Documentation

◆ intrusive_ptr_t() [1/6]

template<class T >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( )
inlinenoexcept

Default constructor.

Constructs a null reference.

Definition at line 106 of file atomic_refcounted.hpp.

◆ intrusive_ptr_t() [2/6]

template<class T >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( T * obj)
inlinenoexcept

Constructor for a raw pointer.

Definition at line 112 of file atomic_refcounted.hpp.

◆ intrusive_ptr_t() [3/6]

template<class T >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( const intrusive_ptr_t< T > & o)
inlinenoexcept

Copy constructor.

Definition at line 119 of file atomic_refcounted.hpp.

◆ intrusive_ptr_t() [4/6]

template<class T >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( intrusive_ptr_t< T > && o)
inlinenoexcept

Move constructor.

Definition at line 126 of file atomic_refcounted.hpp.

◆ intrusive_ptr_t() [5/6]

template<class T >
template<class Y >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( const intrusive_ptr_t< Y > & o)
inlinenoexcept

Constructor from another smart reference.

Since
v.5.2.2

Definition at line 140 of file atomic_refcounted.hpp.

◆ intrusive_ptr_t() [6/6]

template<class T >
template<class Y >
so_5::intrusive_ptr_t< T >::intrusive_ptr_t ( std::unique_ptr< Y > o)
inlinenoexcept

Constructor from unique_ptr instance.

Since
v.5.5.23

Definition at line 155 of file atomic_refcounted.hpp.

◆ ~intrusive_ptr_t()

template<class T >
so_5::intrusive_ptr_t< T >::~intrusive_ptr_t ( )
inlinenoexcept

Destructor.

Definition at line 164 of file atomic_refcounted.hpp.

Member Function Documentation

◆ dismiss_object()

template<class T >
void so_5::intrusive_ptr_t< T >::dismiss_object ( )
inlineprivatenoexcept

Decrement reference count to object and delete it if needed.

Definition at line 295 of file atomic_refcounted.hpp.

◆ ensure_right_T()

template<class T >
static void so_5::intrusive_ptr_t< T >::ensure_right_T ( )
inlinestaticprivate

Definition at line 94 of file atomic_refcounted.hpp.

◆ get()

template<class T >
T * so_5::intrusive_ptr_t< T >::get ( ) const
inlinenodiscardnoexcept

Definition at line 240 of file atomic_refcounted.hpp.

◆ make_reference()

template<class T >
template<class Y >
intrusive_ptr_t< Y > so_5::intrusive_ptr_t< T >::make_reference ( ) const
inlinenoexcept

Make reference with casing to different type.

Since
v.5.2.2

Definition at line 215 of file atomic_refcounted.hpp.

◆ operator bool()

template<class T >
so_5::intrusive_ptr_t< T >::operator bool ( ) const
inlineexplicitnodiscardnoexcept

Is this a null reference?

i.e. whether get() != 0.

Return values
trueif *this manages an object.
falseotherwise.

Definition at line 229 of file atomic_refcounted.hpp.

◆ operator*()

template<class T >
T & so_5::intrusive_ptr_t< T >::operator* ( ) const
inlinenodiscardnoexcept

Definition at line 254 of file atomic_refcounted.hpp.

◆ operator->()

template<class T >
T * so_5::intrusive_ptr_t< T >::operator-> ( ) const
inlinenodiscardnoexcept

Definition at line 247 of file atomic_refcounted.hpp.

◆ operator<()

template<class T >
bool so_5::intrusive_ptr_t< T >::operator< ( const intrusive_ptr_t< T > & o) const
inlinenodiscard

Definition at line 273 of file atomic_refcounted.hpp.

◆ operator=() [1/2]

template<class T >
intrusive_ptr_t & so_5::intrusive_ptr_t< T >::operator= ( const intrusive_ptr_t< T > & o)
inlinenoexcept

Copy operator.

Definition at line 179 of file atomic_refcounted.hpp.

◆ operator=() [2/2]

template<class T >
intrusive_ptr_t & so_5::intrusive_ptr_t< T >::operator= ( intrusive_ptr_t< T > && o)
inlinenoexcept

Move operator.

Definition at line 188 of file atomic_refcounted.hpp.

◆ operator==()

template<class T >
bool so_5::intrusive_ptr_t< T >::operator== ( const intrusive_ptr_t< T > & o) const
inlinenodiscard

Definition at line 267 of file atomic_refcounted.hpp.

◆ reset()

template<class T >
void so_5::intrusive_ptr_t< T >::reset ( )
inlinenoexcept

Drop controlled object.

Since
v.5.2.2

Definition at line 202 of file atomic_refcounted.hpp.

◆ take_object()

template<class T >
void so_5::intrusive_ptr_t< T >::take_object ( )
inlineprivatenoexcept

Increment reference count to object if it's not null.

Definition at line 287 of file atomic_refcounted.hpp.

Friends And Related Symbol Documentation

◆ swap

template<class T >
void swap ( intrusive_ptr_t< T > & a,
intrusive_ptr_t< T > & b )
friend

Swap values.

Definition at line 171 of file atomic_refcounted.hpp.

Member Data Documentation

◆ m_obj

template<class T >
T* so_5::intrusive_ptr_t< T >::m_obj
private

Object controlled by a smart reference.

Definition at line 283 of file atomic_refcounted.hpp.


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