Tools.h++ Class Reference

Table Of Contents
bool operator()(const K& x, const K& y) const
which should return true if x and y are equivalent.
RWTValHashMultiMap<K,T,H,EQ> may contain multiple keys that compare equal to each other.
(RWTValHashMap<K,T,H,EQ> will not accept a key that compares equal to any key already in the
collection.) Equality is based on the comparison object and not on the == operator.
Persistence
Isomorphic.
Examples
//
// tvhmmrat.cpp
//
#include<rw/tvhmmap.h>
#include<iostream.h>
#include<rw/cstring.h>
struct silly_hash{
unsigned long operator()(RWCString x) const
{ return x.length() * (long)x[0]; }
};
int main(){
RWCString trd = "Third";
RWTValHashMultiMap<RWCString,int,silly_hash,equal_to<RWCString> >
contest;
contest.insert("First", 7);
contest.insert(trd,3);
contest.insert(trd,6); // self contains two distinct values
//equivalent to trd
contest.insert("Second",2);
contest.resize(8);
cout << "The table is " << contest.fillRatio() * 100.0
<< "% full<< endl;
return 0;
}
Program Output:
The table is 50% full