Tools.h++ Class Reference

Table Of Contents
As with class RWTPtrHashTable<T>, you must supply a hashing function to the constructor.
The class T must have:
well-defined equality semantics (T::operator==(const T&)).
Persistence
None
Example
This examples exercises a set of RWCStrings.
#include <rw/tphset.h>
#include <rw/cstring.h>
#include <rw/rstream.h>
main() {
RWTPtrHashSet<RWCString> set(RWCString::hash);
set.insert(new RWCString("one"));
set.insert(new RWCString("two"));
set.insert(new RWCString("three"));
set.insert(new RWCString("one"));
cout << set.entries() << endl; // Prints "3"
set.clearAndDestroy();
return 0;
}
Program output:
3
Public Constructor
RWTPtrHashSet<T>(unsigned (*hashFun)(const T&),
size_t buckets = RWDEFAULT_CAPACITY);
Constructs an empty hashing set. The first argument is a pointer to a user-defined hashing
function for items of type T. The table will initally have buckets buckets although this can be
changed with member function resize().
Public Member Functions
RWTPtrHashSet<T>&
Union(const RWTPtrHashSet<T>& h);
Computes the union of self and h, modifying self and returning self.