Request: fgl TFPSList.SortRange
Original Reporter info from Mantis: Alextp
-
Reporter name: CudaText man
Original Reporter info from Mantis: Alextp
- Reporter name: CudaText man
Description:
https://github.com/graemeg/freepascal/blob/master/rtl/objpas/fgl.pp
Many text editors support sorting not only of entire text, but of selected lines. So I need the TFPSList.SortRange(AIndexFrom, AIndexTo) method to do it. Without SortRange, my editor needs to create 2nd list, sort it, move it. This is bad on huge lists (50M items) - memory usage, slow copying list1->list2, list2->list1.
fgl unit gives TFPSList.Sort like this:
procedure TFPSList.Sort(Compare: TFPSListCompareFunc; SortingAlgorithm: PSortingAlgorithm);
var
Context: TFPSList_Sort_Comparer_Context;
begin
Context.Compare := Compare;
SortingAlgorithm^.ItemListSorter_ContextComparer(FList, FCount, FItemSize, @TFPSList_Sort_Comparer, @Context);
end;
SortingAlgorithm^.ItemListSorter_ContextComparer has type:
TItemListSorter_Context = procedure(Items: Pointer; ItemCount, ItemSize: SizeUInt; Comparer: TListSortComparer_Context; Context: Pointer);
And so we can call this func with starting pointer, and count of items! It's possible to add SortRange. Can you add it, pls?
Mantis conversion info:
- Mantis ID: 36802
- Version: 3.3.1