Tools.h++ Class Reference

Table Of Contents
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
insert(T* a);
Adds the object pointed to by a to the end of the list.
void
insertAt(size_t i, T* a);
Adds the object pointed to by a at the index position i. This position must be between zero and
the number of items in the list, or an exception of type RWBoundsError will be thrown.
RWBoolean
isEmpty() const;
Returns TRUE if there are no items in the list, FALSE otherwise.
T*&
last();
T* const&
last() const;
Returns a pointer to the last item in the list. The behavior is undefined if the list is empty.
size_t
occurrencesOf(const 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(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