[Lazarus] TFPGList.Sort
Andrea Mauri
andrea.mauri.75 at gmail.com
Thu Oct 8 17:41:51 CEST 2015
Thanks and sorry for this stupid mistake.
Il 08/ott/2015 16:47, "Michael Van Canneyt" <michael at freepascal.org> ha
scritto:
>
>
> On Thu, 8 Oct 2015, Andrea Mauri wrote:
>
> Dear all,
>>
>> I am trying to sort a simple TIntegerList defined as:
>>
>> TIntegerList = specialize TFPGList<Integer>;
>>
>> In order to sort I introduced a compare function as:
>>
>> function CompareInt(const Item1,
>> Item2: Integer): Integer;
>> begin
>> if Item1 < Item2 then
>> Result:= -1
>> else if Item2 > Item1 then
>>
>
> This is wrong. It is in fact the same condition as your first if.
> it should be
> if Item1>Item2 then
>
> Michael.
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151008/2874d5b4/attachment-0003.html>
More information about the Lazarus
mailing list