Tools.h++ Class Reference

Table Of Contents
the class-defined equality operator.
size_t
occurrencesOf(RWBoolean (*testFun)(const T&, void*),void* d)
const;
Returns the number of objects in the list for which the user-defined "tester" function pointed to
by testFun returns TRUE . The tester function must have the prototype:
RWBoolean yourTester(const T&, 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.
void
prepend(const T& a);
Adds the item a to the beginning of the list.
RWBoolean
remove(const T& a);
Removes the first object which is equal to the object a and returns TRUE. Returns FALSE if
there is no such object. Equality is measured by the class-defined equality operator.
RWBoolean
remove(RWBoolean (*testFun)(const T&, void*), void* d);
Removes the first object for which the user-defined tester function pointed to by testFun returns
TRUE, and returns TRUE. Returns FALSE if there is no such object. The tester function must
have the prototype:
RWBoolean yourTester(const T&, 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.
size_t
removeAll(const T& a);
Removes all objects which are equal to the object a. Returns the number of objects removed.
Equality is measured by the class-defined equality operator.
size_t
removeAll(RWBoolean (*testFun)(const 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(const T&, 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 object at index i. 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.