ug4
ConstSmartPtr< T, FreePolicy > Class Template Reference

#include <smart_pointer.h>

Public Member Functions

SmartPtr< T, FreePolicy > cast_const () const
 performs a const cast More...
 
template<class TDest >
ConstSmartPtr< TDest, FreePolicy > cast_dynamic () const
 preforms a dynamic cast More...
 
template<class TDest >
ConstSmartPtr< TDest, FreePolicy > cast_reinterpret () const
 performs a static cast More...
 
template<class TDest >
ConstSmartPtr< TDest, FreePolicy > cast_static () const
 performs a static cast More...
 
 ConstSmartPtr ()
 
 ConstSmartPtr (const ConstSmartPtr &sp)
 
template<class TPtr >
 ConstSmartPtr (const ConstSmartPtr< TPtr, FreePolicy > &sp)
 
template<class TPtr >
 ConstSmartPtr (const SmartPtr< TPtr, FreePolicy > &sp)
 
 ConstSmartPtr (const T *ptr)
 
 ConstSmartPtr (const T *ptr, int *refCount)
 WARNING: this method is DANGEROUS! More...
 
 ConstSmartPtr (NullSmartPtr)
 
const T * get () const
 
bool invalid () const
 returns true if the pointer is invalid, false if not. More...
 
template<class TDest >
bool is_of_type () const
 
 operator bool () const noexcept
 
bool operator!= (const ConstSmartPtr &sp) const
 
template<class TPtr >
bool operator!= (const SmartPtr< TPtr, FreePolicy > &sp) const
 
bool operator!= (NullSmartPtr) const
 
const T & operator* () const
 
const T * operator-> () const
 
ConstSmartPtroperator= (const ConstSmartPtr &sp)
 
template<class TIn >
ConstSmartPtr< T, FreePolicy > & operator= (const ConstSmartPtr< TIn, FreePolicy > &sp)
 
ConstSmartPtroperator= (const SmartPtr< T, FreePolicy > &sp)
 
template<class TIn >
ConstSmartPtr< T, FreePolicy > & operator= (const SmartPtr< TIn, FreePolicy > &sp)
 
ConstSmartPtroperator= (NullSmartPtr)
 
bool operator== (const ConstSmartPtr &sp) const
 
template<class TPtr >
bool operator== (const SmartPtr< TPtr, FreePolicy > &sp) const
 
bool operator== (NullSmartPtr) const
 
int refcount () const
 
int * refcount_ptr () const
 WARNING: this method is dangerous! More...
 
bool valid () const
 returns true if the pointer is valid, false if not. More...
 
 ~ConstSmartPtr ()
 

Private Member Functions

void release ()
 decrements the refCount and frees the encapsulated pointer if required. More...
 

Static Private Member Functions

static void free_void_ptr (void *ptr)
 

Private Attributes

const T * m_ptr
 
int * m_refCount
 

Friends

class ConstSmartPtr< void >
 

Constructor & Destructor Documentation

◆ ConstSmartPtr() [1/7]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr< T, FreePolicy >::ConstSmartPtr ( )
inlineexplicit

◆ ConstSmartPtr() [2/7]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr< T, FreePolicy >::ConstSmartPtr ( const T *  ptr)
inlineexplicit

◆ ConstSmartPtr() [3/7]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr< T, FreePolicy >::ConstSmartPtr ( NullSmartPtr  )
inline

◆ ConstSmartPtr() [4/7]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr< T, FreePolicy >::ConstSmartPtr ( const ConstSmartPtr< T, FreePolicy > &  sp)
inline

◆ ConstSmartPtr() [5/7]

template<typename T , template< class TT > class FreePolicy>
template<class TPtr >
ConstSmartPtr< T, FreePolicy >::ConstSmartPtr ( const SmartPtr< TPtr, FreePolicy > &  sp)
inline

this template method allows to assign smart-pointers that encapsulate derivates of T. Make sure that the pointer-type of TSmartPtr is castable to T*.

References ConstSmartPtr< T, FreePolicy >::m_refCount.

◆ ConstSmartPtr() [6/7]

template<typename T , template< class TT > class FreePolicy>
template<class TPtr >
ConstSmartPtr< T, FreePolicy >::ConstSmartPtr ( const ConstSmartPtr< TPtr, FreePolicy > &  sp)
inline

◆ ~ConstSmartPtr()

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr< T, FreePolicy >::~ConstSmartPtr ( )
inline

◆ ConstSmartPtr() [7/7]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr< T, FreePolicy >::ConstSmartPtr ( const T *  ptr,
int *  refCount 
)
inlineexplicit

WARNING: this method is DANGEROUS!

You should only use this constructor if you really know what you're doing! The following methods are required for SmartPtr<void> and casts

References ConstSmartPtr< T, FreePolicy >::m_refCount.

Member Function Documentation

◆ cast_const()

template<typename T , template< class TT > class FreePolicy>
SmartPtr<T, FreePolicy> ConstSmartPtr< T, FreePolicy >::cast_const ( ) const
inline

◆ cast_dynamic()

template<typename T , template< class TT > class FreePolicy>
template<class TDest >
ConstSmartPtr<TDest, FreePolicy> ConstSmartPtr< T, FreePolicy >::cast_dynamic ( ) const
inline

◆ cast_reinterpret()

template<typename T , template< class TT > class FreePolicy>
template<class TDest >
ConstSmartPtr<TDest, FreePolicy> ConstSmartPtr< T, FreePolicy >::cast_reinterpret ( ) const
inline

◆ cast_static()

template<typename T , template< class TT > class FreePolicy>
template<class TDest >
ConstSmartPtr<TDest, FreePolicy> ConstSmartPtr< T, FreePolicy >::cast_static ( ) const
inline

◆ free_void_ptr()

template<typename T , template< class TT > class FreePolicy>
static void ConstSmartPtr< T, FreePolicy >::free_void_ptr ( void *  ptr)
inlinestaticprivate

◆ get()

◆ invalid()

template<typename T , template< class TT > class FreePolicy>
bool ConstSmartPtr< T, FreePolicy >::invalid ( ) const
inline

◆ is_of_type()

template<typename T , template< class TT > class FreePolicy>
template<class TDest >
bool ConstSmartPtr< T, FreePolicy >::is_of_type ( ) const
inline

◆ operator bool()

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr< T, FreePolicy >::operator bool ( ) const
inlineexplicitnoexcept

◆ operator!=() [1/3]

template<typename T , template< class TT > class FreePolicy>
bool ConstSmartPtr< T, FreePolicy >::operator!= ( const ConstSmartPtr< T, FreePolicy > &  sp) const
inline

◆ operator!=() [2/3]

template<typename T , template< class TT > class FreePolicy>
template<class TPtr >
bool ConstSmartPtr< T, FreePolicy >::operator!= ( const SmartPtr< TPtr, FreePolicy > &  sp) const
inline

◆ operator!=() [3/3]

template<typename T , template< class TT > class FreePolicy>
bool ConstSmartPtr< T, FreePolicy >::operator!= ( NullSmartPtr  ) const
inline

◆ operator*()

template<typename T , template< class TT > class FreePolicy>
const T& ConstSmartPtr< T, FreePolicy >::operator* ( ) const
inline

◆ operator->()

template<typename T , template< class TT > class FreePolicy>
const T* ConstSmartPtr< T, FreePolicy >::operator-> ( ) const
inline

◆ operator=() [1/5]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr& ConstSmartPtr< T, FreePolicy >::operator= ( const ConstSmartPtr< T, FreePolicy > &  sp)
inline

◆ operator=() [2/5]

template<typename T , template< class TT > class FreePolicy>
template<class TIn >
ConstSmartPtr<T, FreePolicy>& ConstSmartPtr< T, FreePolicy >::operator= ( const ConstSmartPtr< TIn, FreePolicy > &  sp)
inline

◆ operator=() [3/5]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr& ConstSmartPtr< T, FreePolicy >::operator= ( const SmartPtr< T, FreePolicy > &  sp)
inline

◆ operator=() [4/5]

template<typename T , template< class TT > class FreePolicy>
template<class TIn >
ConstSmartPtr<T, FreePolicy>& ConstSmartPtr< T, FreePolicy >::operator= ( const SmartPtr< TIn, FreePolicy > &  sp)
inline

◆ operator=() [5/5]

template<typename T , template< class TT > class FreePolicy>
ConstSmartPtr& ConstSmartPtr< T, FreePolicy >::operator= ( NullSmartPtr  )
inline

◆ operator==() [1/3]

template<typename T , template< class TT > class FreePolicy>
bool ConstSmartPtr< T, FreePolicy >::operator== ( const ConstSmartPtr< T, FreePolicy > &  sp) const
inline

◆ operator==() [2/3]

template<typename T , template< class TT > class FreePolicy>
template<class TPtr >
bool ConstSmartPtr< T, FreePolicy >::operator== ( const SmartPtr< TPtr, FreePolicy > &  sp) const
inline

◆ operator==() [3/3]

template<typename T , template< class TT > class FreePolicy>
bool ConstSmartPtr< T, FreePolicy >::operator== ( NullSmartPtr  ) const
inline

◆ refcount()

template<typename T , template< class TT > class FreePolicy>
int ConstSmartPtr< T, FreePolicy >::refcount ( ) const
inline

◆ refcount_ptr()

template<typename T , template< class TT > class FreePolicy>
int* ConstSmartPtr< T, FreePolicy >::refcount_ptr ( ) const
inline

WARNING: this method is dangerous!

This method should never be used since it may be removed in future versions of the SmartPtr class. It is featured in order to allow to implement a template-constructor that casts element-pointers of a smart pointer.

References ConstSmartPtr< T, FreePolicy >::m_refCount.

Referenced by ConstSmartPtr< T, FreePolicy >::operator=().

◆ release()

template<typename T , template< class TT > class FreePolicy>
void ConstSmartPtr< T, FreePolicy >::release ( )
inlineprivate

◆ valid()

Friends And Related Function Documentation

◆ ConstSmartPtr< void >

template<typename T , template< class TT > class FreePolicy>
friend class ConstSmartPtr< void >
friend

Member Data Documentation

◆ m_ptr

◆ m_refCount


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