Tools.h++ Class Reference

Table Of Contents
Objects within the collection will be grouped together based on an equality object of type EQ.
EQ must ensure this grouping via public member
bool operator()(const T& x, const T& y) const
which should return true if x and y are equivalent, false otherwise.
RWTValHashSet<T,H,EQ> will not accept an item that compares equal to an item already in the
collection. (RWTValHashMultiSet<T,H,EQ> may contain multiple items that compare equal to
each other.) Equality is based on the equality object and not on the == operator.
Persistence
Isomorphic
Example
//
// tvhsstr.cpp
//
#include <rw/tvhset.h>
#include <rw/cstring.h>
#include <iostream.h>
struct silly_hash{
unsigned long operator()(RWCString x) const
{ return x.length() * (long)x(0); }
};
main(){
RWTValHashSet<RWCString,silly_hash,equal_to<RWCString> > set1;
RWTValHashSet<RWCString,silly_hash,equal_to<RWCString> > set2;
set1.insert("one");
set1.insert("two");
set1.insert("three");
//Rejected, no duplicates allowed
set1.insert("one");
cout << set1.entries() << endl; // Prints "3"
set2.insert("one");
set2.insert("five");
//Rejected, no duplicates allowed