MeixnerGC  1.0
gc_ptr< T > Class Template Reference

#include <gc_ptr.h>

Inheritance diagram for gc_ptr< T >:
Collaboration diagram for gc_ptr< T >:

Public Member Functions

 gc_ptr ()
 
 gc_ptr (nullptr_t)
 
 gc_ptr (const gc_ptr &o)
 
 gc_ptr (gc_ptr &&o)
 
 gc_ptr (const gc_base_ptr &o, T *p)
 
template<class U >
 gc_ptr (const gc_ptr< U > &o)
 
gc_ptroperator= (const gc_ptr &o)
 
gc_ptroperator= (gc_ptr &&o)
 
gc_ptroperator= (nullptr_t)
 
T * get () const noexcept
 
 operator T * () const noexcept
 
T & operator* () const noexcept
 
T * operator-> () const noexcept
 
T & operator[] (int idx) const noexcept
 
void reset ()
 
gc_ptr< T > & operator++ () noexcept
 
gc_ptr< T > & operator-- () noexcept
 
gc_ptr< T > operator++ (int) noexcept
 
gc_ptr< T > operator-- (int) noexcept
 
template<class U >
gc_ptr< T > & operator+= (const U &z) noexcept
 
template<class U >
gc_ptr< T > & operator-= (const U &z) noexcept
 
- Public Member Functions inherited from gc_base_ptr
 gc_base_ptr (gc_object *c=nullptr)
 
 gc_base_ptr (const gc_base_ptr &o)
 
 gc_base_ptr (gc_base_ptr &&o)
 
void operator= (nullptr_t)
 
void operator= (const gc_base_ptr &o)
 
void operator= (gc_base_ptr &&o)
 
void reset ()
 
 ~gc_base_ptr ()
 

Protected Attributes

T * ptr
 
- Protected Attributes inherited from gc_base_ptr
enum gc_base_ptr::PtrType type
 
std::atomic< gc_base_ptr * > next
 
std::atomic< gc_object * > object
 

Friends

template<class U >
class gc_ptr
 

Additional Inherited Members

- Protected Types inherited from gc_base_ptr
enum  PtrType { ROOT, GC_HEAP }
 

Detailed Description

template<class T>
class gc_ptr< T >

garbage collected pointer

Constructor & Destructor Documentation

template<class T>
gc_ptr< T >::gc_ptr ( )
inline

constructor, set up gc_ptr with NULL

template<class T>
gc_ptr< T >::gc_ptr ( nullptr_t  )
inline

constructor, set up gc_ptr with NULL

template<class T>
gc_ptr< T >::gc_ptr ( const gc_ptr< T > &  o)
inline

copy constructor

Parameters
[in]opointer to be copied
template<class T>
gc_ptr< T >::gc_ptr ( gc_ptr< T > &&  o)
inline

move constructor

Parameters
[in]opointer to be moved
template<class T>
gc_ptr< T >::gc_ptr ( const gc_base_ptr o,
T *  p 
)
inline

aliasing constructor, the pointer p is stored, but references to o are set up. This is useful, when the pointer points to an inner element of o

Parameters
[in]oreferenced object, used for garbage collection
[in]ppointer
template<class T>
template<class U >
gc_ptr< T >::gc_ptr ( const gc_ptr< U > &  o)
inline

cast constructor

Parameters
[in]opointer to be copied

Member Function Documentation

template<class T>
T* gc_ptr< T >::get ( ) const
inlinenoexcept

get pointer

Returns
pointer
template<class T>
gc_ptr< T >::operator T * ( ) const
inlinenoexcept

get pointer

Returns
pointer
template<class T>
T& gc_ptr< T >::operator* ( ) const
inlinenoexcept

dereference pointer

template<class T>
gc_ptr<T>& gc_ptr< T >::operator++ ( )
inlinenoexcept

prefix increment

template<class T>
gc_ptr<T> gc_ptr< T >::operator++ ( int  )
inlinenoexcept

postfix increment

template<class T>
template<class U >
gc_ptr<T>& gc_ptr< T >::operator+= ( const U &  z)
inlinenoexcept

+= operator

template<class T>
gc_ptr<T>& gc_ptr< T >::operator-- ( )
inlinenoexcept

prefix decrement

template<class T>
gc_ptr<T> gc_ptr< T >::operator-- ( int  )
inlinenoexcept

postfix decrement

template<class T>
template<class U >
gc_ptr<T>& gc_ptr< T >::operator-= ( const U &  z)
inlinenoexcept

-= operator

template<class T>
T* gc_ptr< T >::operator-> ( ) const
inlinenoexcept

access via pointer

template<class T>
gc_ptr& gc_ptr< T >::operator= ( const gc_ptr< T > &  o)
inline

assignment operator, emulates standard C++ casting rules

Parameters
[in]opointer to be assigned.
template<class T>
gc_ptr& gc_ptr< T >::operator= ( gc_ptr< T > &&  o)
inline

move operator, emulates standard C++ casting rules

Parameters
[in]opointer to be assigned.
template<class T>
gc_ptr& gc_ptr< T >::operator= ( nullptr_t  )
inline

assignment with nullptr

template<class T>
T& gc_ptr< T >::operator[] ( int  idx) const
inlinenoexcept

array access

template<class T>
void gc_ptr< T >::reset ( )
inline

reset pointer to null

Member Data Documentation

template<class T>
T* gc_ptr< T >::ptr
protected

managed pointer


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