Tools.h++ Manual

104011 Tandem Computers Incorporated 23-27
23
For each type of
RWGSortedVector
you must include one (and only one) call
to the macro
implement
somewhere in your code for both the
RWGSortedVector
itself and for its base class
RWGVector
.
Insertions and retrievals are done using a binary search.
Note – The constructor of a RWGSortedVector(val) requires a pointer to a
“comparison function.”
This function should have prototype:
int comparisonFunction(const
val
* a, const
val
* b);
and should return an int less than, greater than, or equal to zero, depending on
whether the item pointed to by
a
is less than, greater than, or equal to the item
pointed to by
b
. Candidates from the collection will appear as
a
, the key as
b
.