I see that sortbase.pp has prepared sorting functionality with context (=custom parameter) that I need to use. See TSortingAlgorithm.PtrListSorter_ContextComparer and QuickSort_PtrList_Context.

But I don't know how to use them within TList because TFPList / TList doesn't publish any Sort() overloads that use them. Furthermore FList is private which means I cannot access it in a derived object and I cannot add this functionality for my own list object.

My question is: how can I sort a TList/TFPList with a custom context parameter?:

  TList = class(TObject,IFPObserved)
    // ...
    procedure Sort(Compare: TListSortComparer_Context);

If this is not possible (which I think it is not), will a patch be accepted that adds these methods to TFPList/TList?:
    procedure Sort(Compare: TListSortComparer_Context);
    procedure Sort(Compare: TListSortComparer_Context; SortingAlgorithm: PSortingAlgorithm);


fpc-devel maillist  -  fpc-devel@lists.freepascal.org

Reply via email to