Tools.h++ Manual

22-106 104011 Tandem Computers Incorporated
22
Program output:
Found date June 2, 1952
April 1, 1990
March 30, 1946
June 2, 1952
Public constructors
RWTValSlist<T>();
Construct an empty list.
RWTValSlist<T>(const RWTValSlist<T>& list);
Construct a copy of the list
list
. Depending on the nature of the copy
constructor of
T
, this could be relatively expensive because every item in the
list must be copied.
Public operators
RWTValSlist&<T>operator=(const RWTValSlist<T>& list);
Sets self to a copy of the list list. Depending on the nature of the copy
constructor of
T
, this could be relatively expensive because every item in the
list must be copied.
T& operator[](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.
if (dates.find(RWDate(2, "June", 52), ret)){
cout << "Found date " << ret << endl;
}
// Remove in reverse order:
while (!dates.isEmpty())
cout << dates.removeLast() << endl;
return 0;
}
Code Example 22-7 (Continued)