# PArray< T > Class Template Reference

This template class maps the `PArrayObjects` to a specific object type. More...

`#include <array.h>`

Inheritance diagram for PArray< T >:

List of all members.

## Public Member Functions

Construction
| PArray (PINDEX initialSize=0)
| Create a new array of objects.
Overrides from class PObject
virtual PObject * | Clone () const
| Make a complete duplicate of the array.
New functions for class
T & | operator[] (PINDEX index) const
| Retrieve a reference to the object in the array.

## Protected Member Functions

| PArray (int dummy, const PArray *c)

## Detailed Description

### template<class T>
class PArray< T >

This template class maps the `PArrayObjects` to a specific object type.

The functions in this class primarily do all the appropriate casting of types.

Note that if templates are not used the `PARRAY` macro will simulate the template instantiation.

## Constructor & Destructor Documentation

template<class T>

PArray< T >::PArray | ( | PINDEX | initialSize = `0` | ) | `[inline]`

Create a new array of objects.

The array is initially set to the specified size with each entry having NULL as is pointer value.

Note that by default, objects placed into the list will be deleted when removed or when all references to the list are destroyed.

Parameters:

  initialSize | Initial number of objects in the array.

template<class T>

PArray< T >::PArray | ( | int | dummy,
|  | const PArray< T > * | c |
| ) |  |  | `[inline, protected]`

## Member Function Documentation

template<class T>

virtual PObject* PArray< T >::Clone | ( |  | ) | const`[inline, virtual]`

Make a complete duplicate of the array.

Note that all objects in the array are also cloned, so this will make a complete copy of the array.

Reimplemented from PObject.

template<class T>

T& PArray< T >::operator[] | ( | PINDEX | index | ) | const`[inline]`

Retrieve a reference to the object in the array.

If there was not an object at that ordinal position or the index was beyond the size of the array then the function asserts.

Returns:
  Reference to the object at `index` position.

Parameters:

  index | Index position in the collection of the object.

Reimplemented in PStringArray.

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

- array.h