Array< T > Class Template Reference
#include <prom_options.hh>
Collaboration diagram for Array< T >:
[legend]List of all members.
Detailed Description
template<class T>
class Array< T >
class Array Templated, safe, resizable array class.
Classes to be stored in an Array must provide an empty constructor, plus valid copy ctor, assignment operator, and dtor (these last three need not be provided explicitly when the default will suffice).
Copying and assignment of an Array does a deep copy. If you want shallow copy behavior, create an Array of SmartPtrs or handles.
Bounds are checked upon access, unless the NOBOUNDSCHECK flag has been set at compile time. Bounds checking can slow down critical code by at least an order of magnitude, so we recommend turning bounds checking off for distribution code. A bad memory read or write can cause a serious error, so we recommend leaving bounds checking on during development.
- Author:
- Kevin Long and Leslea Lehoucq
Constructor & Destructor Documentation
|
template<class T> |
| Array< T >::Array |
( |
int |
n |
) |
[inline] |
|
|
|
Allocate an array with n elements |
|
template<class T> |
| Array< T >::Array |
( |
int |
n, |
|
|
const T * |
cArray |
|
) |
[inline] |
|
|
|
Copy n elements from a C array |
|
template<class T> |
| Array< T >::Array |
( |
int |
n, |
|
|
const T & |
t |
|
) |
[inline] |
|
|
|
Allocate n elements, and fill with value |
Member Function Documentation
|
template<class T> |
| Array< T > & Array< T >::append |
( |
const T & |
rhs |
) |
[inline] |
|
|
|
Stick a new entry at the end of the array. Resize to allow space for the new entry |
|
template<class T> |
| int Array< T >::byteCount |
( |
|
) |
const [inline] |
|
|
|
compute number of bytes needed to store array |
|
template<class T> |
| int Array< T >::hashCode |
( |
|
) |
const [inline] |
|
|
|
compute a hash code for the array |
|
template<class T> |
| int Array< T >::length |
( |
|
) |
const [inline] |
|
|
template<class T> |
| const T & Array< T >::operator[] |
( |
int |
i |
) |
const [inline] |
|
|
|
Read-only access to a the i-th element. If NOBOUNDSCHECK is not set, throw a IndexRangeException upon violation of bounds. |
|
template<class T> |
| T & Array< T >::operator[] |
( |
int |
i |
) |
[inline] |
|
|
|
Read/Write access to a the i-th element. If NOBOUNDSCHECK is not set, throw a IndexRangeException upon violation of bounds. |
|
template<class T> |
| void Array< T >::remove |
( |
int |
i |
) |
[inline] |
|
|
|
Remove the i-th element. Subsequent elements are bumped back to fill in the hole. |
|
template<class T> |
| int Array< T >::reserve |
( |
|
) |
const [inline] |
|
|
template<class T> |
| void Array< T >::reserve |
( |
int |
n |
) |
[inline] |
|
|
template<class T> |
| void Array< T >::resize |
( |
int |
newN |
) |
[inline] |
|
|
template<class T> |
| String Array< T >::toString |
( |
|
) |
const [inline] |
|
The documentation for this class was generated from the following file:
Generated on Fri May 21 14:17:55 2004 by
1.3.7