TFPGInterfacedObjectList.Sort procedure
Sort the objects in the list.
Declaration
procedure Sort(Compare: TCompareFunc)
procedure Sort(Compare: TCompareFunc;
SortingAlgorithm: PSortingAlgorithm)Arguments
Compare | Compare function for 2 objects: function(const Item1, Item2: T): Integer; |
SortingAlgorithm |
Description
Sort sorts the elements in the list using the provided
Compare function. The list passes 2 items to the compare function.
The result of this function determines how the items will be sorted:
- If the result of this function is negative, the first object (
Item1) is assumed to be 'less' than the second object (Item2) and will be moved before the second in the list. - If the function result is positive, the first object (
Item1) is assumed to be 'greater than' the second object (Item2)and will be moved after the second in the list. - if the function result is zero, the objects are assumed to be 'equal' and no moving will take place.
Errors
None.
See also
- Sorted
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
