Tools.h++ Manual
104011 Tandem Computers Incorporated 22-23
22
Program output:
The list does contain a Schnauzer
Cairn Terrier
Fox Terrier
Irish Terrier
Schnauzer
Public constructors
RWTPtrDlist<T>();
Constructs an empty list.
RWTPtrDlist<T>(const RWTPtrDlist<T>& c);
Constructs a new doubly-linked list as a shallow copy of
c
. After construction,
pointers will be shared between the two collections.
Public operators
RWTPtrDlist& operator=(const RWTPtrDlist<T>&
c);
Sets self to a shallow copy of
c
. Afterwards, pointers will be shared between
the two collections.
T*& operator[](size_t i);
T* operator[](size_t i) const;
Returns a pointer to the
i
'th value in the list. The first variant can be used as
an l-value, the second cannot. The index
i
must be between zero and the
number of items in the collection less one, or an exception of type
TOOL_INDEX
will be thrown.
Public member functions
void append(T* a);
Appends the item pointed to by
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 the prototype:
void
yourFun
(T* a, 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
.