Tools.h++ Manual
104011 Tandem Computers Incorporated 22-53
22
Program output:
Found date June 2, 1952
April 1, 1990
March 30, 1946
June 2, 1952
Public constructors
RWTPtrSlist<T>();
Construct an empty list.
RWTPtrSlist<T>(const RWTPtrSlist<T>& c);
Constructs a new singly-linked list as a shallow copy of
c
. After construction,
pointers will be shared between the two collections.
Public operators
RWTPtrSlist& operator=(const RWTPtrSlist& 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:
delete d;
}
return 0;
}
Code Example 22-4 (Continued)