TC::ScopedArray< DATA_TYPE, DELETER > Class Template Reference
[Base Classes and Functions]

A class whose instances act like arrays and delete the data when the instance goes out of scope. More...

#include <TCScopedArray.h>

Collaboration diagram for TC::ScopedArray< DATA_TYPE, DELETER >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef DATA_TYPE *ThisType::* unspecified_bool_type

Public Member Functions

 ScopedArray ()
 Construct the object pointing to a empty array.
 ScopedArray (DATA_TYPE *ptr)
 Construct the object pointing to a specified array.
 ~ScopedArray ()
 Destructor deletes the pointer.
const DATA_TYPE & operator[] (uint32 index) const
 Get element at specified index.
DATA_TYPE & operator[] (uint32 index)
 Get element at specified index.
 operator unspecified_bool_type () const
 User define conversion for if like "if (pointer)".
bool operator! () const
 User define conversion for if like "if (!pointer)".

Private Types

typedef ScopedArray< DATA_TYPE > ThisType

Private Attributes

DATA_TYPE * m_array


Detailed Description

template<class DATA_TYPE, class DELETER = CheckedArrayDelete>
class TC::ScopedArray< DATA_TYPE, DELETER >

A class whose instances act like arrays and delete the data when the instance goes out of scope.

TC::ScopedArray mimics a built-in pointer except that it guarantees deletion of the object pointed to on destruction of the TC::ScopedArray TC::ScopedArray is a simple solution for simple needs; use TC::SharedPtr or std::auto_ptr if your needs are more complex.

Definition at line 63 of file TCScopedArray.h.


Member Typedef Documentation

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
typedef ScopedArray<DATA_TYPE> TC::ScopedArray< DATA_TYPE, DELETER >::ThisType [private]

Definition at line 66 of file TCScopedArray.h.

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
typedef DATA_TYPE* ThisType::* TC::ScopedArray< DATA_TYPE, DELETER >::unspecified_bool_type

Definition at line 82 of file TCScopedArray.h.


Constructor & Destructor Documentation

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
TC::ScopedArray< DATA_TYPE, DELETER >::ScopedArray (  )  [inline]

Construct the object pointing to a empty array.

Definition at line 70 of file TCScopedArray.h.

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
TC::ScopedArray< DATA_TYPE, DELETER >::ScopedArray ( DATA_TYPE *  ptr  )  [inline, explicit]

Construct the object pointing to a specified array.

Definition at line 72 of file TCScopedArray.h.

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
TC::ScopedArray< DATA_TYPE, DELETER >::~ScopedArray (  )  [inline]

Destructor deletes the pointer.

Definition at line 75 of file TCScopedArray.h.

References TC::ScopedArray< DATA_TYPE, DELETER >::m_array.


Member Function Documentation

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
const DATA_TYPE& TC::ScopedArray< DATA_TYPE, DELETER >::operator[] ( uint32  index  )  const [inline]

Get element at specified index.

Definition at line 78 of file TCScopedArray.h.

References TC::ScopedArray< DATA_TYPE, DELETER >::m_array.

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
DATA_TYPE& TC::ScopedArray< DATA_TYPE, DELETER >::operator[] ( uint32  index  )  [inline]

Get element at specified index.

Definition at line 80 of file TCScopedArray.h.

References TC::ScopedArray< DATA_TYPE, DELETER >::m_array.

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
TC::ScopedArray< DATA_TYPE, DELETER >::operator unspecified_bool_type (  )  const [inline]

User define conversion for if like "if (pointer)".

Definition at line 84 of file TCScopedArray.h.

References TC::ScopedArray< DATA_TYPE, DELETER >::m_array.

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
bool TC::ScopedArray< DATA_TYPE, DELETER >::operator! (  )  const [inline]

User define conversion for if like "if (!pointer)".

Definition at line 89 of file TCScopedArray.h.

References TC::ScopedArray< DATA_TYPE, DELETER >::m_array.


Member Data Documentation

template<class DATA_TYPE , class DELETER = CheckedArrayDelete>
DATA_TYPE* TC::ScopedArray< DATA_TYPE, DELETER >::m_array [private]


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

Copyright (c) Thomas Goessler 2003 - 2008