Sorting Routines

The utilib/src/sort directory contains definitions for a variety of sorting and ordering functions, which are defined in the following header files:

Comparison Semantics

Many routines in UTILIB perform a comparison between two objects and return an integer flag. If we are evaluating how A relates to B, then the standard comparison semantics for the return value x is that x is less than zero if A is before B in the order, x is greater than zero if A is after B in the order, and x is zero if they are equal. In the context of numerical values, A is before B if A is less than B. Finally, note that if the comparison function is a method of an object, like

    A.compare(B)
then the comparison is evaluating how A relates to B (and not how B relates to A).