Tools.h++ Class Reference

Table Of Contents
via a public member
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 vector of RWDates is exercised.
//
// tpsrtvec.cpp
//
#include <rw/rwdate.h>
#include <rw/tpsrtvec.h>
#include <iostream.h>
main(){
RWTPtrSortedVector<RWDate, greater<RWDate> > vec;
vec.insert(new RWDate(10, "Aug", 1991));
vec.insert(new RWDate(9, "Aug", 1991));
vec.insert(new RWDate(1, "Sep", 1991));
vec.insert(new RWDate(14, "May", 1990));
vec.insert(new RWDate(1, "Sep", 1991)); // Add a duplicate
vec.insert(new RWDate(2, "June", 1991));
for (int i=0; i<vec.entries(); i++)
cout << *vec[i] << endl;
vec.clearAndDestroy();
return 0;
}
Program Output:
09/01/91
09/01/91
08/10/91
08/09/91
06/02/91