Tools.h++ Class Reference

Table Of Contents
Returns TRUE if there are no items in the collection, FALSE otherwise.
T* const&
last() const;
Returns a pointer to the last item in the collection. If there are no items in the collection then an
exception of type RWBoundsError will occur.
size_t
length() const;
Returns the number of items currently in the collection.
size_t
occurrencesOf(const T* a) const;
Performs a binary search, returning the number of items that are equal to the object pointed to by
a. Equality is measured by the class-defined equality operator for type T.
T*
remove(const T* a);
Performs a binary search, removing the first object which is equal to the object pointed to by a
and returns a pointer to it, or nil if no such object could be found. Equality is measured by the
class-defined equality operator for type T.
size_t
removeAll(const T* a);
Performs a binary search, removing all objects which are equal to the object pointed to by a.
Returns the number of objects removed. Equality is measured by the class-defined equality
operator for type T.
T*
removeAt(size_t i);
Removes the object at index i and returns a pointer to it. An exception of type RWBoundsError
will be thrown if i is not a valid index. Valid indices are from zero to the number of items in the
list less one.
T*
removeFirst();
Removes the first item in the collection and returns a pointer to it. An exception of type
RWBoundsError will be thrown if the list is empty.
T*
removeLast();
Removes the last item in the collection and returns a pointer to it. An exception of type
RWBoundsError will be thrown if the list is empty.
void
resize(size_t N);
Changes the capacity of the collection to N. Note that the number of objects in the collection
does not change, just the capacity.