counted_ptr< T > Class Template Reference

Reference counted pointer. More...

`#include <smartptr.h>`

## Public Member Functions

| counted_ptr (T *p=NULL)
| counted_ptr (const T &r)
| counted_ptr (const counted_ptr< T > &rhs)
const T & | operator* () const
T & | operator* ()
const T * | operator-> () const
T * | operator-> ()
const T * | get () const
T * | get ()
void | attach (const T &p)
counted_ptr< T > & | operator= (const counted_ptr< T > &rhs)

## Detailed Description

template<class T>
class counted_ptr< T >

Reference counted pointer.

Template Parameters

  T | class or type

users should declare `m_referenceCount` as `std::atomic<unsigned>` (or similar) under C++ 11

Definition at line 129 of file smartptr.h.

## Constructor & Destructor Documentation

## counted_ptr() [1/3]

template<class T >

counted_ptr< T >::counted_ptr | ( | T * | p = `NULL` | ) |

explicit

Definition at line 155 of file smartptr.h.

## counted_ptr() [2/3]

template<class T >

counted_ptr< T >::counted_ptr | ( | const T & | r | ) |

inline

Definition at line 133 of file smartptr.h.

## counted_ptr() [3/3]

template<class T >

counted_ptr< T >::counted_ptr | ( | const counted_ptr< T > & | rhs | ) |

Definition at line 162 of file smartptr.h.

## ~counted_ptr()

template<class T >

counted_ptr< T >::~counted_ptr | ( |  | ) |

Definition at line 169 of file smartptr.h.

## Member Function Documentation

## operator*() [1/2]

template<class T >

const T & counted_ptr< T >::operator* | ( |  | ) | const

inline

Definition at line 138 of file smartptr.h.

## operator*() [2/2]

template<class T >

T & counted_ptr< T >::operator* | ( |  | ) |

inline

Definition at line 139 of file smartptr.h.

## operator->() [1/2]

template<class T >

const T * counted_ptr< T >::operator-> | ( |  | ) | const

inline

Definition at line 141 of file smartptr.h.

## operator->() [2/2]

template<class T >

T * counted_ptr< T >::operator-> | ( |  | ) |

inline

Definition at line 142 of file smartptr.h.

## get() [1/2]

template<class T >

const T * counted_ptr< T >::get | ( |  | ) | const

inline

Definition at line 144 of file smartptr.h.

## get() [2/2]

template<class T >

T * counted_ptr< T >::get | ( |  | ) |

Definition at line 191 of file smartptr.h.

## attach()

template<class T >

void counted_ptr< T >::attach | ( | const T & | p | ) |

Definition at line 175 of file smartptr.h.

## operator=()

template<class T >

counted_ptr< T > & counted_ptr< T >::operator= | ( | const counted_ptr< T > & | rhs | ) |

Definition at line 203 of file smartptr.h.

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

- smartptr.h