Comparator<T> typedef
The signature of a generic comparison function.
A comparison function represents an ordering on a type of objects. A total ordering on a type means that for two values, either they are equal or one is greater than the other (and the latter must then be smaller than the former).
A Comparator function represents such a total ordering by returning
- a negative integer if
ais smaller thanb, - zero if
ais equal tob, and - a positive integer if
ais greater thanb.
Implementation
typedef Comparator<T> = int Function(T a, T b);