Tools.h++ Class Reference

Table Of Contents
Parameter T represents the type of object to be inserted into the list, either a class or fundamental type.
The class T must have:
A default constructor;
well-defined copy semantics (T::T(const T&) or equivalent);
well-defined assignment semantics (T::operator=(const T&) or equivalent);
well-defined equality semantics (T::operator==(const T&)).
Persistence
Isomorphic
Example
In this example, a singly-linked list of RWDates is exercised.
#include <rw/tvslist.h>
#include <rw/rwdate.h>
#include <rw/rstream.h>
main() {
RWTValSlist<RWDate> dates;
dates.insert(RWDate(2, "June", 52)); // 6/2/52
dates.insert(RWDate(30, "March", 46)); // 3/30/46
dates.insert(RWDate(1, "April", 90)); // 4/1/90
// Now look for one of the dates:
RWDate ret;
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;
}
Program output:
Found date June 2, 1952
April 1, 1990
March 30, 1946
June 2, 1952