Tools.h++ Class Reference

Table Of Contents
const T&
at(size_t i) const;
Returns a copy of the item at index i. The results cannot be used as an lvalue. 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.
void
clear();
Removes all items from the list. Their destructors, if any, will be called.
RWBoolean
contains(const T& a) const;
Returns TRUE if the list contains an object that is equal to the object a. Returns FALSE
otherwise. Equality is measured by the class-defined equality operator.
RWBoolean
contains(RWBoolean (*testFun)(const T&, void*), void* d)
const;
Returns TRUE if the list contains an item for which the user-defined "tester" function pointed to
by testFun returns TRUE . Returns FALSE otherwise. 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
entries() const;
Returns the number of items that are currently in the collection.
RWBoolean
find(const T& target, T& k) const;
Returns TRUE if the list contains an object that is equal to the object target and puts a copy of the
matching object into k. Returns FALSE otherwise and does not touch k. Equality is measured by
the class-defined equality operator. If you do not need a copy of the found object, use contains()
instead.
RWBoolean
find(RWBoolean (*testFun)(const T&, void*),void* d, T& k)
const;
Returns TRUE if the list contains an object for which the user-defined tester function pointed to
by testFun returns TRUE and puts a copy of the matching object into k. Returns FALSE
otherwise and does not touch k. 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. If you do not need a copy of the found object, use
contains() instead.