Tools.h++ Manual

104011 Tandem Computers Incorporated 22-39
22
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
void apply(void (*applyFun)(T*,
void*), void* d);
Inherited from class
RWTPtrHashTable<T>
.
void clear();
Inherited from class
RWTPtrHashTable<T>
.
void clearAndDestroy();
Inherited from class
RWTPtrHashTable<T>
.
RWBoolean contains(T* a) const;
Inherited from class
RWTPtrHashTable<T>
.
size_t entries() const;
Inherited from class
RWTPtrHashTable<T>
.
T* find(T* a) const;
Inherited from class
RWTPtrHashTable<T>
.
void insert(T* a);
Redefined from class
RWTPtrHashTable<T>
to allow an object of a given
value to be inserted only once.
cout << set.entries() << endl;// Prints "3"
return 0;
}
Code Example 22-3 (Continued)