template<class T>
C++ STL style iterator variable. Call begin() to get the first iterator, pre-increment (++i) the iterator to get to the next value. Use dereference (*i) to access the element.
Constructor & Destructor Documentation
template<class T>
Creates a zero length array (no heap allocation occurs until resize).
template<class T>
Creates an array of size.
template<class T>
Copy constructor.
template<class T>
Destructor does not delete() the objects if T is a pointer type (e.g.
T = int*) instead, it deletes the pointers themselves and leaves the objects. Call deleteAll if you want to dealocate the objects referenced. Do not call deleteAll if
Member Function Documentation
template<class T>
Append the elements of array. Cannot be called with this array as an argument.
template<class T>
template<class T>
template<class T>
template<class T>
Add an element to the end of the array. Will not shrink the underlying array under any circumstances. It is safe to append an element that is already in the array.
template<class T>
template<class T>
C++ STL style iterator method. Returns the first iterator element. Do not change the size of the array while iterating.
template<class T>
"The member function returns the storage currently allocated to hold the controlled sequence, a value at least as large as size()" For compatibility with std::vector.
template<class T>
Removes all elements. Use resize(0, false) or fastClear if you want to remove all elements without deallocating the underlying array so that future append() calls will be faster.
template<class T>
Returns true if the given element is in the array.
template<class T>
Calls delete on all objects[0. ..size-1] and sets the size to zero.
template<class T>
template<class T>
C++ STL style iterator method. Returns one after the last iterator element.
template<class T>
resize(0, false)
template<class T>
Swaps element index with the last element in the array then shrinks the array by one.
template<class T>
Resizes without shrinking the underlying array.
template<class T>
template<class T>
Finds an element and returns the iterator to it. If the element isn't found then returns end().
template<class T>
Returns the index of (the first occurance of) an index or -1 if not found.
template<class T>
template<class T>
Returns element firstIndex(), performing a check in debug mode to ensure that there is at least one.
template<class T>
template<class T>
"The member function returns a reference to the first element of the controlled sequence, which must be non-empty. " For compatibility with std::vector.
template<class T>
"The member function returns a reference to the first element of the controlled sequence, which must be non-empty. " For compatibility with std::vector.
template<class T>
template<class T>
template<class T>
Inserts at the specified index and shifts all other elements up by one.
template<class T>
Returns element lastIndex().
template<class T>
Returns the last element, performing a check in debug mode that there is at least one element.
template<class T>
Returns size() - 1.
template<class T>
Number of elements in the array. (Same as size; this is just here for convenience).
template<class T>
Computes a median partition using the default comparator and a dynamically allocated temporary working array. If the median is not in the array, it is chosen to be the largest value smaller than the true median.
template<class T>
template<typename Comparator>
Paritions the array into those below the median, those above the median, and those elements equal to the median in expected O(n) time using quickselect. If the array has an even number of different elements, the median for partition purposes is the largest value less than the median.
template<class T>
Returns element middleIndex().
template<class T>
Returns element middleIndex().
template<class T>
Returns iFloor(size() / 2), throws an assertion in debug mode if the array is empty.
template<class T>
Pushes a new element onto the end and returns its address. This is the same as A.resize(A.size() + 1, false); A.last()
template<class T>
template<class T>
Assignment operator.
template<class T>
template<class T>
Performs bounds checks in debug mode.
template<class T>
template<class T>
Performs bounds checks in debug mode.
template<class T>
Uses < and == on elements to perform a partition. See partition().
template<class T>
template<typename Comparator>
The output arrays are resized with fastClear() so that if they are already of the same size as this array no memory is allocated during partitioning.
int compare(int A, int B) {
if (A < B) {
return 1;
} else if (A == B) {
return 0;
} else {
return -1;
}
}
template<class T>
Removes the last element and returns it. By default, shrinks the underlying array.
template<class T>
"The member function removes the last element of the controlled sequence, which must be non-empty." For compatibility with std::vector.
template<class T>
Pops the last element and discards it without returning anything. Faster than pop. By default, does not shrink the underlying array.
template<class T>
template<class T>
Pushes an element onto the end (appends).
template<class T>
Alias to provide std::vector compatibility.
template<class T>
template<class T>
template<class T>
Redistributes the elements so that the new order is statistically independent of the original order. O(n) time.
template<class T>
template<class T>
Removes count elements from the array referenced either by index or Iterator.
template<class T>
This makes resizing much faster but can waste memory.
template<class T>
Resizes, calling the default constructor for newly created objects and shrinking the underlying array as needed (and calling destructors as needed).
template<class T>
Reverse the elements of the array in place.
template<class T>
Number of elements in the array.
template<class T>
Sorts the array in increasing order using the > or < operator.
To invoke this method on Array<T>, T must override those operator. You can overide these operators as follows:
template<class T>
Sort using a specific less-than function, e.g. :
bool __cdecl myLT(const MyClass& elem1, const MyClass& elem2) {
return elem1.x < elem2.x;
}
Note that for pointer arrays, the
bool __cdecl myLT(MyClass*const& elem1, MyClass*const& elem2) {
return elem1->x < elem2->x;
}
template<class T>
template<typename StrictWeakOrdering>
The StrictWeakOrdering can be either a class that overloads the function call operator() or a function pointer of the form
template<class T>
template<class T>
Sorts elements beginIndex through and including endIndex.
template<class T>
"The member function swaps the controlled sequences between *this and str." Note that this is slower than the optimal std implementation. For compatibility with std::vector.
The documentation for this class was generated from the following file: Generated on Thu Aug 2 11:40:44 2007 for G3D by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||