Tools.h++ Class Reference

Table Of Contents
table.removeAll("Oregon");
cout << "Now the table "
<< (table.contains("Oregon") ? "does " : "does not ")
<< "contain Oregon";
return 0;
}
Program output
The table does contain Oregon
Now the table does not contain Oregon
Public Constructors
RWTValHashTable<T>(unsigned (*hashFun)(const T&),
size_t buckets = RWDEFAULT_CAPACITY);
Constructs a new hash table. 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().
RWTValHashTable<T>(const RWTValHashTable<T>& table);
Constructs a new hash table as a copy of table. The new table will have the same number of
buckets as the old table. Hence, although objects must be copied into the new table, they will not
be hashed.
Public Operators
RWTValHashTable&
operator=(const RWTValHashTable<T>&);
Sets self to a copy of table. Afterwards, the new table will have the same number of buckets as
the old table. Hence, although objects must be copied into the new table, they will not be hashed.
Public Member Functions
void
apply(void (*applyFun)(T&, void*), void* d);
Applies the user-defined function pointed to by applyFun to every item in the table. This function
must have prototype:
void yourFun(T& a, void* d);
Client data may be passed through as parameter d.
void
clear();
Removes all items from the collection.
RWBoolean
contains(const T& val) const;