Tools.h++ Class Reference

Table Of Contents
bool operator()(const T& x, const T& y)
which returns true if x should precede y within the collection. The structure less<T> from the
C++-standard header file <functional> is an example. Note that items in the collection will be
dereferenced before being compared.
Persistence
Isomorphic.
Example
In this example, a sorted doubly-linked list of RWDates is exercised.
//
// tpsrtdli.cpp
//
#include <rw/tpsrtdli.h>
#include <rw/rwdate.h>
#include <iostream.h>
main(){
RWTPtrSortedDList<RWDate,greater<RWDate> > lst;
lst.insert(new RWDate(10, "Aug", 1991));
lst.insert(new RWDate(9, "Aug", 1991));
lst.insert(new RWDate(1, "Sep", 1991));
lst.insert(new RWDate(14, "May", 1990));
lst.insert(new RWDate(1, "Sep", 1991)); // Add a duplicate
lst.insert(new RWDate(2, "June", 1991));
for (int i=0; i<lst.entries(); i++)
cout << *lst[i] << endl;
lst.clearAndDestroy();
return 0;
}
Program Output:
09/01/91
09/01/91
08/10/91
08/09/91
06/02/91
05/14/90