I have a number of Typed TLists which I am having problems getting to sort
Normally, for an untyped TList, I would have a function such as:
function SortByJob(Item1: Pointer; Item2: Pointer): Integer;
var
p1, p2: JobPointer;
begin
p1 := JobPointer(Item1);
p2 := JobPointer(Item2);
if p1.job > p2.job then
Result := 1
else
if p1.job = p2.job then
Result := 0
else
Result := -1
end;
Which would be called by the list
JobList.Sort(SortByJob)
However I have decided in my current application that we want to lock the TLists to certain pointer types, so in the above example we would have the JobList declared as:
JobList: array[0..4] of TList<JobsPointer>;
Now when I call
JobList[0].Sort(SortByJob)
I get a "not enough parameters" error.
Any ideas?
I have compared that if I use the Sort function above on an untyped "standard" TList then it will compile correctly...