Tools.h++ Manual
104011 Tandem Computers Incorporated 22-25
22
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
.
T* first() const;
Returns a pointer to the first item in the list. The behavior is undefined if the
list is empty.
T* get();
Returns a pointer to the first item in the list and removes the item. The
behavior is undefined if the list is empty.
size_t index(T* a);
Returns the index of the first object that is equal to the object pointed to by
a
,
or
RW_NPOS
if there is no such object. Equality is measured by the class-
defined equality operator for type T.
size_t index(RWBoolean (*testFun)(T*,
void*), void* d) const;
Returns the index of the first object for which the user-defined tester function
pointed to by
testFun
returns
TRUE
, or
RW_NPOS
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
.
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
TOOL_INDEX
will be thrown.
RWBoolean isEmpty() const;
Returns
TRUE
if there are no items in the list,
FALSE
otherwise.
T* last() const;
Returns a pointer to the last item in the list. The behavior is undefined if the
list is empty.