Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::interprocess::intrusive_ptr< T, VoidPointer > Class Template Reference

The intrusive_ptr class template stores a pointer to an object with an embedded reference count. More...

#include <intrusive_ptr.hpp>

Public Types

typedef
boost::intrusive::pointer_traits
< VoidPointer >::template
rebind_pointer< T >::type 
pointer
 Provides the type of the internal stored pointer. More...
 
typedef T element_type
 Provides the type of the stored pointer. More...
 

Public Member Functions

 intrusive_ptr ()
 Constructor. More...
 
 intrusive_ptr (const pointer &p, bool add_ref=true)
 Constructor. More...
 
 intrusive_ptr (intrusive_ptr const &rhs)
 Copy constructor. More...
 
template<class U >
 intrusive_ptr (intrusive_ptr< U, VP > const &rhs)
 Constructor from related. More...
 
 ~intrusive_ptr ()
 Destructor. More...
 
intrusive_ptroperator= (intrusive_ptr const &rhs)
 Assignment operator. More...
 
template<class U >
intrusive_ptroperator= (intrusive_ptr< U, VP > const &rhs)
 Assignment from related. More...
 
intrusive_ptroperator= (pointer rhs)
 Assignment from pointer. More...
 
pointerget ()
 Returns a reference to the internal pointer. More...
 
const pointerget () const
 Returns a reference to the internal pointer. More...
 
Toperator* () const
 Returns *get(). More...
 
const pointeroperator-> () const
 Returns *get(). More...
 
pointeroperator-> ()
 Returns get(). More...
 
 operator unspecified_bool_type () const
 Conversion to boolean. More...
 
bool operator! () const
 Not operator. More...
 
void swap (intrusive_ptr &rhs)
 Exchanges the contents of the two smart pointers. More...
 

Detailed Description

template<class T, class VoidPointer>
class boost::interprocess::intrusive_ptr< T, VoidPointer >

The intrusive_ptr class template stores a pointer to an object with an embedded reference count.

intrusive_ptr is parameterized on T (the type of the object pointed to) and VoidPointer(a void pointer type that defines the type of pointer that intrusive_ptr will store). intrusive_ptr<T, void *> defines a class with a T* member whereas intrusive_ptr<T, offset_ptr<void> > defines a class with a offset_ptr<T> member. Relies on unqualified calls to:

void intrusive_ptr_add_ref(T * p); void intrusive_ptr_release(T * p);

with (p != 0)

The object is responsible for destroying itself.

Member Typedef Documentation

template<class T, class VoidPointer>
typedef T boost::interprocess::intrusive_ptr< T, VoidPointer >::element_type

Provides the type of the stored pointer.

template<class T, class VoidPointer>
typedef boost::intrusive:: pointer_traits<VoidPointer>::template rebind_pointer<T>::type boost::interprocess::intrusive_ptr< T, VoidPointer >::pointer

Provides the type of the internal stored pointer.

Constructor & Destructor Documentation

template<class T, class VoidPointer>
boost::interprocess::intrusive_ptr< T, VoidPointer >::intrusive_ptr ( )
inline

Constructor.

Initializes internal pointer to 0. Does not throw

template<class T, class VoidPointer>
boost::interprocess::intrusive_ptr< T, VoidPointer >::intrusive_ptr ( const pointer p,
bool  add_ref = true 
)
inline

Constructor.

Copies pointer and if "p" is not zero and "add_ref" is true calls intrusive_ptr_add_ref(to_raw_pointer(p)). Does not throw

References boost::sp_adl_block::intrusive_ptr_add_ref(), and boost::interprocess::to_raw_pointer().

template<class T, class VoidPointer>
boost::interprocess::intrusive_ptr< T, VoidPointer >::intrusive_ptr ( intrusive_ptr< T, VoidPointer > const &  rhs)
inline

Copy constructor.

Copies the internal pointer and if "p" is not zero calls intrusive_ptr_add_ref(to_raw_pointer(p)). Does not throw

References boost::sp_adl_block::intrusive_ptr_add_ref(), and boost::interprocess::to_raw_pointer().

template<class T, class VoidPointer>
template<class U >
boost::interprocess::intrusive_ptr< T, VoidPointer >::intrusive_ptr ( intrusive_ptr< U, VP > const &  rhs)
inline

Constructor from related.

Copies the internal pointer and if "p" is not zero calls intrusive_ptr_add_ref(to_raw_pointer(p)). Does not throw

References boost::sp_adl_block::intrusive_ptr_add_ref(), and boost::interprocess::to_raw_pointer().

template<class T, class VoidPointer>
boost::interprocess::intrusive_ptr< T, VoidPointer >::~intrusive_ptr ( )
inline

Destructor.

If internal pointer is not 0, calls intrusive_ptr_release(to_raw_pointer(m_ptr)). Does not throw

References boost::sp_adl_block::intrusive_ptr_release(), and boost::interprocess::to_raw_pointer().

Member Function Documentation

template<class T, class VoidPointer>
pointer& boost::interprocess::intrusive_ptr< T, VoidPointer >::get ( )
inline

Returns a reference to the internal pointer.

Does not throw

template<class T, class VoidPointer>
const pointer& boost::interprocess::intrusive_ptr< T, VoidPointer >::get ( ) const
inline

Returns a reference to the internal pointer.

Does not throw

template<class T, class VoidPointer>
boost::interprocess::intrusive_ptr< T, VoidPointer >::operator unspecified_bool_type ( ) const
inline

Conversion to boolean.

Does not throw

template<class T, class VoidPointer>
bool boost::interprocess::intrusive_ptr< T, VoidPointer >::operator! ( ) const
inline

Not operator.

Does not throw

template<class T, class VoidPointer>
T& boost::interprocess::intrusive_ptr< T, VoidPointer >::operator* ( ) const
inline

Returns *get().

Does not throw

template<class T, class VoidPointer>
const pointer& boost::interprocess::intrusive_ptr< T, VoidPointer >::operator-> ( ) const
inline

Returns *get().

Does not throw

template<class T, class VoidPointer>
pointer& boost::interprocess::intrusive_ptr< T, VoidPointer >::operator-> ( )
inline

Returns get().

Does not throw

template<class T, class VoidPointer>
intrusive_ptr& boost::interprocess::intrusive_ptr< T, VoidPointer >::operator= ( intrusive_ptr< T, VoidPointer > const &  rhs)
inline

Assignment operator.

Equivalent to intrusive_ptr(r).swap(*this). Does not throw

References boost::interprocess::intrusive_ptr< T, VoidPointer >::swap().

template<class T, class VoidPointer>
template<class U >
intrusive_ptr& boost::interprocess::intrusive_ptr< T, VoidPointer >::operator= ( intrusive_ptr< U, VP > const &  rhs)
inline

Assignment from related.

Equivalent to intrusive_ptr(r).swap(*this). Does not throw

References boost::interprocess::intrusive_ptr< T, VoidPointer >::swap().

template<class T, class VoidPointer>
intrusive_ptr& boost::interprocess::intrusive_ptr< T, VoidPointer >::operator= ( pointer  rhs)
inline

Assignment from pointer.

Equivalent to intrusive_ptr(r).swap(*this). Does not throw

References boost::interprocess::intrusive_ptr< T, VoidPointer >::swap().

template<class T, class VoidPointer>
void boost::interprocess::intrusive_ptr< T, VoidPointer >::swap ( intrusive_ptr< T, VoidPointer > &  rhs)
inline

Exchanges the contents of the two smart pointers.

Does not throw

Referenced by boost::interprocess::intrusive_ptr< T, VoidPointer >::operator=().


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