Tools.h++ Class Reference

Table Of Contents
size_t
occurrencesOfReference(const T* a) const;
Returns the number of times which the item pointed to by a occurs in the list. Because
items cannot be inserted into a list more than once, this function can only return zero or
one.
void
prepend(T* a);
Prepends the item pointed to by a to the beginning of the list.
T*
remove(RWBoolean (*testFun)(const T*, void*),void* d);
Removes and returns the first item for which the user-defined tester function pointed to
by testFun returns TRUE, or nil if there is no such item. The tester function must have the
prototype:
RWBoolean yourTester(const T* item, void* d);
For each item in the list this function will be called with the item as the first argument.
Client data may be passed through as parameter d.
T*
removeAt(size_t i);
Removes and returns the item at index i. The index i must be between zero and the
number of items in the collection less one or an exception of type TOOL_INDEX will be
thrown.
T*
removeFirst();
Removes and returns the first item in the list, or nil if there are no items in the list.
T*
removeLast();
Removes and returns the last item in the list, or nil if there are no items in the list. This
function is relatively slow because removing the last link in a singly-linked list
necessitates access to the next-to-the-last link, requiring the whole list to be searched.
T*
removeReference(T* a);
Removes and returns the link with address a. The link must be in the list. In a
singly-linked list this function is not very efficient.