arr2< T > Class Template Reference
[Array classes]
#include <arr.h>
List of all members.
Detailed Description
template<typename T>
class arr2< T >
Two-dimensional array type. The storage ordering is the same as in C. An entry is located by address arithmetic, not by double dereferencing. The indices start at zero.
Definition at line 183 of file arr.h.
Constructor & Destructor Documentation
Creates a zero-sized array.
Definition at line 200 of file arr.h.
template<typename T>
arr2< T >::arr2 |
( |
long |
sz1, |
|
|
long |
sz2 | |
|
) |
| | [inline] |
Creates an array with the dimensions sz1 and sz2.
Definition at line 202 of file arr.h.
Creates the array as a copy of orig.
Definition at line 205 of file arr.h.
Frees the memory associated with the array.
Definition at line 208 of file arr.h.
Member Function Documentation
template<typename T>
long arr2< T >::size1 |
( |
|
) |
const [inline] |
Returns the first array dimension.
Definition at line 211 of file arr.h.
template<typename T>
long arr2< T >::size2 |
( |
|
) |
const [inline] |
Returns the second array dimension.
Definition at line 213 of file arr.h.
template<typename T>
long arr2< T >::size |
( |
|
) |
const [inline] |
Returns the total array size, i.e. the product of both dimensions.
Definition at line 215 of file arr.h.
template<typename T>
void arr2< T >::alloc |
( |
long |
sz1, |
|
|
long |
sz2 | |
|
) |
| | [inline] |
Allocates space for an array with sz1*sz2 elements. The content of the array is undefined on exit. sz1 or sz2 can be 0. If sz1*sz2 is the same as the currently allocated space, no reallocation is performed.
Definition at line 221 of file arr.h.
template<typename T>
void arr2< T >::fast_alloc |
( |
long |
sz1, |
|
|
long |
sz2 | |
|
) |
| | [inline] |
Allocates space for an array with sz1*sz2 elements. The content of the array is undefined on exit. sz1 or sz2 can be 0. If sz1*sz2 is smaller than the currently allocated space, no reallocation is performed.
Definition at line 231 of file arr.h.
template<typename T>
void arr2< T >::dealloc |
( |
|
) |
[inline] |
Deallocates the space and makes the array zero-sized.
Definition at line 239 of file arr.h.
template<typename T>
void arr2< T >::fill |
( |
const T & |
val |
) |
[inline] |
Sets all array elements to val.
Definition at line 242 of file arr.h.
template<typename T>
arr2& arr2< T >::operator= |
( |
const arr2< T > & |
orig |
) |
[inline] |
Changes the array to be a copy of orig.
Definition at line 246 of file arr.h.
template<typename T>
template<typename T2>
T* arr2< T >::operator[] |
( |
T2 |
n |
) |
[inline] |
Returns a pointer to the beginning of slice n.
Definition at line 261 of file arr.h.
template<typename T>
template<typename T2>
const T* arr2< T >::operator[] |
( |
T2 |
n |
) |
const [inline] |
Returns a constant pointer to the beginning of slice n.
Definition at line 263 of file arr.h.
template<typename T>
void arr2< T >::minmax |
( |
T & |
minv, |
|
|
T & |
maxv | |
|
) |
| | const [inline] |
Returns the minimum and maximum entry in minv and maxv, respectively. Throws an exception if the array is zero-sized.
Definition at line 268 of file arr.h.
template<typename T>
void arr2< T >::swap |
( |
arr2< T > & |
other |
) |
[inline] |
Swaps contents and sizes with other.
Definition at line 281 of file arr.h.
The documentation for this class was generated from the following file: