Tools.h++ Manual
22-26 104011 Tandem Computers Incorporated
22
size_t occurrencesOf(T* a) const;
Returns the number of objects in the list that are equal to the object pointed to
by
a
. Equality is measured by the class-defined equality operator for type
T
.
size_t occurrencesOf(RWBoolean
(*testFun)(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
(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
.
void prepend(T* a);
Adds the item pointed to by
a
to the beginning of the list.
T* remove(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(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);