Tools.h++ Class Reference

Table Of Contents
T*
remove(const T* a);
Removes 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.
T*
remove(RWBoolean (*testFun)(T*, void*),void* d);
Removes the first object for which the user-defined tester function pointed to by testFun returns
TRUE and returns a pointer to it, or nil if there is no such object. 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.
size_t
removeAll(const T* a);
Removes 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.
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 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 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.