Re: [fpc-devel] TFPList / TList Sort with Context parameter
I needed to get things working so I could not wait for an answer any longer. I posted a patch: https://bugs.freepascal.org/view.php?id=35962 Best Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] TFPList / TList Sort with Context parameter
On 12.08.2019 13:02, Ondrej Pokorny wrote: 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); The methods will be: procedure Sort(Compare: TListSortComparer_Context; Context: Pointer); procedure Sort(Compare: TListSortComparer_Context; Context: Pointer; SortingAlgorithm: PSortingAlgorithm); obviously... Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] TFPList / TList Sort with Context parameter
Hello! 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); end; 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); Best Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel