Tools.h++ Manual
104011 Tandem Computers Incorporated 22-107
22
T operator[](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
TOOL_INDEX
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.
Public member functions
void append(const T& a);
Adds the item
a
to the end of the list.
void apply(void (*applyFun)(T&,
void*), void* d);
Applies the user-defined function pointed to by
applyFun
to every item in the
list. This function must have prototype:
void
yourFun
(T& a, void* d);
Client data may be passed through as parameter
d
.
T& at(size_t i);
Returns a reference to the item at index
i
. The results can be used as an lvalue.
An exception of type
TOOL_INDEX
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 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
TOOL_INDEX
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);