Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# SmartArray< T > Class Template Reference

Wrapper class of an array of objects of class T. It efficiently handles the copies of the array. More...

`#include <SmartArray.h>`

List of all members.

## Public Methods
void | Set (const T &x)
| Makes all elements equal to x.
void | Add (const T &x)
void | AddTail (const T &x)

## Detailed Description

### template<class T>
class SmartArray< T >

Wrapper class of an array of objects of class T. It efficiently handles the copies of the array.

This class wraps a pointer to an array of objects of class T, an keeps track of the number of references to it. If any non-constant function is called, for an object with number of references grater than 1, a copy of the array is performed

This essentially means that a copy of the array will be created only if there is a chance that a function is modifying the contents of a shared array. Therefore, whenever possible, the constant version of operator[]() must be called to avoid unnecessary copies of the array.

Definition at line 66 of file SmartArray.h.

## Member Function Documentation

template<class T>
void SmartArray< T >::Add | ( | const T & | x | ) | `[inline]`

| Adds an element after the last element without increasing the size of the array. Definition at line 282 of file SmartArray.h. Referenced by SmartArray< SmartMatrix< MEMDATA > >::AddTail(), DAGSearchDatabase::GetClosest(), and DAGSearchDatabase::GetKClosest().

template<class T>
void SmartArray< T >::AddTail | ( | const T & | x | ) | `[inline]`

| Adds an element after the last element. It increases the size of the arrayif necessary. Definition at line 289 of file SmartArray.h. Referenced by ShockGraph::GroupShockPoints().

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

- SmartArray.h