DynamicArray< T > Class Template Reference

A simple object wrapper for dynamically-allocated arrays. More...

#include <DynamicArray.h++>

List of all members.

Public Types

typedef T value_type
typedef T * iterator
typedef const T * const_iterator
typedef T & reference
typedef const T & const_reference

Public Member Functions

 DynamicArray (size_t size)
 Construct a new DynamicArray with the given initial size.
 ~DynamicArray () throw ()
 Destructor.
void resize (size_t size, bool copy=false)
 Resize the array to a new size.
T * release () throw ()
 Release ownership of the array.
bool isNull () const throw ()
 Determine if this array is NULL.
T * data () throw ()
 Get the underlying array.
const T * data () const throw ()
 Get the underlying array.
size_t size () const throw ()
 Get the size of the array.
T & operator[] (int index) throw (OutOfBoundsException)
 Index operator.
operator[] (int index) const throw (OutOfBoundsException)
 Index operator.
 operator T * () throw ()
 Cast operator.
 operator const T * () const throw ()
 Cast operator.
bool operator! () const throw ()
 Unary NOT operator.
iterator begin () throw ()
const_iterator begin () const throw ()
iterator end () throw ()
const_iterator end () const throw ()

Detailed Description

template<typename T>
class ccxx::DynamicArray< T >

A simple object wrapper for dynamically-allocated arrays.

See section 17.5.4 of The C++ Programming Language. The array is heap-allocated and can be resized after construction. An array of length zero is considered to be "null".

Author:
Mark Lindner

Member Typedef Documentation

typedef const T* const_iterator
typedef const T& const_reference
typedef T* iterator
typedef T& reference
typedef T value_type

Constructor & Destructor Documentation

DynamicArray ( size_t  size  )  [inline]

Construct a new DynamicArray with the given initial size.

Parameters:
size The initial size, as a number of elements.
~DynamicArray (  )  throw () [inline]

Destructor.


Member Function Documentation

const_iterator begin (  )  const throw () [inline]
iterator begin (  )  throw () [inline]
const T* data (  )  const throw () [inline]

Get the underlying array.

Returns:
A pointer to the beginning of the array.
T* data (  )  throw () [inline]

Get the underlying array.

Returns:
A pointer to the beginning of the array.
const_iterator end (  )  const throw () [inline]
iterator end (  )  throw () [inline]
bool isNull (  )  const throw () [inline]

Determine if this array is NULL.

operator const T * (  )  const throw () [inline]

Cast operator.

operator T * (  )  throw () [inline]

Cast operator.

bool operator! (  )  const throw () [inline]

Unary NOT operator.

T operator[] ( int  index  )  const throw (OutOfBoundsException) [inline]

Index operator.

T& operator[] ( int  index  )  throw (OutOfBoundsException) [inline]

Index operator.

T* release (  )  throw () [inline]

Release ownership of the array.

Returns:
The array.
void resize ( size_t  size,
bool  copy = false 
) [inline]

Resize the array to a new size.

Allocates a new array, and optionally copies as many elements from the old array as will fit to the new one.

Parameters:
size The new size, as a number of elements.
copy If true, copy the elements from the old array.
size_t size (  )  const throw () [inline]

Get the size of the array.

Returns:
The size, in elements.

The documentation for this class was generated from the following file:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3