UtilArray


A UtilArray<T> is a wrapper around ordinary C++ arrays. The main reason for having UtilArray is that it is not possible to have a UtilPtr to an ordinary array, but it is possible to have a UtilPtr to a UtilArray.

template <class T>
class UtilArray {
public:
  const uint4 length;
  UtilArray(uint4);
  ~UtilArray();
  UtilArray<T>& operator=(const UtilArray<T>&);
  Bool operator==(const UtilArray<T>&) const;
  T& operator[](uint4);
};


const uint4 length
This member is the length of the array.
UtilArray(uint4 l)
The constructor creates a UtilArray of size l; the elements are all initialized with their default constructor. If l is negative or zero, the size will be zero.
~UtilArray()
The destructor destroys the UtilArray, including destructing all of the elements.
UtilArray<T>& operator=(const UtilArray<T>& x)
This operator copies the elements of x into the UtilArray. If the arrays are different sizes, then the number of elements it copies is the size of the smaller array.
Bool operator==(const UtilArray<T>& x)
This operator compares the elements of the array with the elements of x. If the arrays are of different sizes, they are always considered not equal.
T& operator[](uint4 x)
This operator allows accessing element of the array, just as you would expect. Accessing elements less than zero or equal to or greater than length will cause an assertion failure in debug builds.