Tools.h++ Manual

104011 Tandem Computers Incorporated 22-57
22
size_t removeAll(RWBoolean
(*testFun)(T*, void*), void* d);
Removes all objects for which the user-defined tester function pointed to by
testFun
returns
TRUE
. Returns the number of objects removed. The tester
function must have the prototype:
RWBoolean
yourTester
(T*, void* d);
This function will be called for each item in the list, with a pointer to the item
as the first argument. Client data may be passed through as parameter
d
.
T* removeAt(size_t i);
Removes the object at index
i
and returns a pointer to it. An exception of type
TOOL_INDEX
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 list and returns a pointer to it. The behavior is
undefined if the list is empty.
T* removeLast()
Removes the last item in the list and returns a pointer to it. The behavior is
undefined if the list is empty. 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 that the whole list be searched.