TFPSListCompareFunc procedure type
Compare list items callback signature.
Declaration
TFPSListCompareFunc = function(Key1: Pointer; Key2: Pointer): Integer
of objectArguments
Key1 | First key value. |
Key2 | Second key value. |
Function result
Is
key1 less than
key2.
Description
TFPSListCompareFunc is used in the
Sort
method to compare 2 elements. The list passes 2 pointers to the actual items
to the compare function. The result of this function determines how the pointers will be sorted:
- If the result of this function is negative, the first key (
key1) is assumed to be 'less' than the second key (key2) and will be moved before the second in the list. - If the function result is positive, the first key (
key1) pointer is assumed to be 'greater than' the second key (key2)and will be moved after the second in the list. - if the function result is zero, the keys are assumed to be 'equal' and no moving will take place.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
