Compare.h
Classes
- Global Functions -- signature of comparison functions (full description)
- ObjCompare -- compare two objects (full description)
Interface
- typedef int ObjCompareFunc (const void*, const void*)
Review Status
- Reviewed By:
- Friso Olnon
- Date Reviewed:
- 1995/02/24
Synopsis
This typedef defines the signature of the comparison functions used
in, for instance, the Sort class: functions
with two const void* arguments returning an
int value. One such function is defined in the
ObjCompare class.
Member Description
typedef int ObjCompareFunc (const void*, const void*)
template<class T> class ObjCompare
Interface
- Public Members
- static int compare (const void* obj1, const void* obj2)
Review Status
- Reviewed By:
- Friso Olnon
- Date Reviewed:
- 1995/02/24
Synopsis
The templated class ObjCompare<T> really is only a place
holder for the static function compare which compares two
objects of type T.
Template Type Argument Requirements (T)
Member Description
static int compare (const void* obj1, const void* obj2)
Compare two objects, and return
- -1 if obj1 < obj2;
- 0 if obj1 == obj2;
- 1 otherwise.
The function is not inlined allowing one to take the address of
it. Furthermore, the function's signature agrees with
ObjCompareFunc so
that it can be used in the Sort class.