Main Page | Modules | Alphabetical List | Class List | File List | Class Members | File Members

arr< T > Class Template Reference
[Array classes]

#include <arr.h>

List of all members.

Public Member Functions

 arr ()
 arr (long sz)
 arr (long sz, const T &inival)
 arr (const arr &orig)
 ~arr ()
long size () const
void alloc (long sz)
void dealloc ()
void fill (const T &val)
arroperator= (const arr &orig)
T & operator[] (long n)
T & operator[] (int n)
const T & operator[] (long n) const
const T & operator[] (int n) const
 operator T * ()
 operator const T * () const
void sort ()
void minmax (T &minv, T &maxv) const
void transfer (arr &other)
void swap (arr &other)


Detailed Description

template<typename T>
class arr< T >

One-dimensional array type.

Definition at line 66 of file arr.h.


Constructor & Destructor Documentation

template<typename T>
arr< T >::arr  )  [inline]
 

Creates a zero-sized array.

Definition at line 83 of file arr.h.

template<typename T>
arr< T >::arr long  sz  )  [inline]
 

Creates an array with sz entries.

Definition at line 85 of file arr.h.

template<typename T>
arr< T >::arr long  sz,
const T &  inival
[inline]
 

Creates an array with sz entries, and initializes them with inival.

Definition at line 88 of file arr.h.

template<typename T>
arr< T >::arr const arr< T > &  orig  )  [inline]
 

Creates an array which is a copy of orig. The data in orig is duplicated.

Definition at line 92 of file arr.h.

template<typename T>
arr< T >::~arr  )  [inline]
 

Frees the memory allocated by the object.

Definition at line 95 of file arr.h.


Member Function Documentation

template<typename T>
long arr< T >::size  )  const [inline]
 

Returns the current array size.

Definition at line 98 of file arr.h.

template<typename T>
void arr< T >::alloc long  sz  )  [inline]
 

Allocates space for sz elements. The content of the array is undefined on exit. sz can be 0. If sz is the same as the current size, no reallocation is performed.

Definition at line 103 of file arr.h.

template<typename T>
void arr< T >::dealloc  )  [inline]
 

Deallocates the memory held by the array, and sets the array size to 0.

Definition at line 112 of file arr.h.

template<typename T>
void arr< T >::fill const T &  val  )  [inline]
 

Writes val into every element of the array.

Definition at line 115 of file arr.h.

template<typename T>
arr& arr< T >::operator= const arr< T > &  orig  )  [inline]
 

Changes the array to be a copy of orig.

Definition at line 119 of file arr.h.

template<typename T>
T& arr< T >::operator[] long  n  )  [inline]
 

Returns a reference to element #n

Definition at line 134 of file arr.h.

template<typename T>
T& arr< T >::operator[] int  n  )  [inline]
 

Returns a reference to element #n

Definition at line 136 of file arr.h.

template<typename T>
const T& arr< T >::operator[] long  n  )  const [inline]
 

Returns a constant reference to element #n

Definition at line 138 of file arr.h.

template<typename T>
const T& arr< T >::operator[] int  n  )  const [inline]
 

Returns a constant reference to element #n

Definition at line 140 of file arr.h.

template<typename T>
arr< T >::operator T *  )  [inline]
 

Returns a pointer to the first element, or 0 if the array is zero-sized.

Definition at line 144 of file arr.h.

template<typename T>
arr< T >::operator const T *  )  const [inline]
 

Returns a constant pointer to the first element, or 0 if the array is zero-sized.

Definition at line 147 of file arr.h.

template<typename T>
void arr< T >::sort  )  [inline]
 

Sorts the elements in the array, in ascending order.

Definition at line 153 of file arr.h.

template<typename T>
void arr< T >::minmax T &  minv,
T &  maxv
const [inline]
 

Returns the minimum and maximum entry in minv and maxv, respectively. Does nothing if the array is zero-sized.

Definition at line 158 of file arr.h.

template<typename T>
void arr< T >::transfer arr< T > &  other  )  [inline]
 

Assigns the contents and size of other to the array. On exit, other is yero-sized.

Definition at line 171 of file arr.h.

template<typename T>
void arr< T >::swap arr< T > &  other  )  [inline]
 

Swaps contents and size with other.

Definition at line 174 of file arr.h.


The documentation for this class was generated from the following file:
Generated on Fri Jul 8 09:37:14 2005 for LevelS C++ support library