What’s the difference between TList and TFPGList?  Which one is better for this 
example?
 
James
 
From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of Vojtech 
Cihák via fpc-pascal
Sent: Tuesday, September 8, 2020 10:29 AM
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Cc: Vojtěch Čihák <vojtech.ci...@atlas.cz>
Subject: Re: [fpc-pascal] TFPObjectlist example
 
Hi,
 
some crippled formatting, so again:
 
However, in your case (records) I would rather use TFPGList from FGL unit:
 
1) add {$modeswitch ADVANCEDRECORDS}
 
2) add FGL to uses
 
3) define class operator =
 
test = record
    Port :String;
    Size :Byte;
    Status :Word;
    class operator = (A,B: test): Boolean;
  End; 
4) implement it
class operator test.=(A, B: test): Boolean;
begin
  Result:=(A.Port=B.Port) and (A.Size=B.Size);  // and ...
end;   
5) define specialized list:
 
  TMyL = specialize TFPGList<test>;
 
6) create it
 
  MyList: TMyL;
 
  ...
 
  MyList:=TMyL.Create;
 
Now you can work with it comfortably
 
MyList[1].Port:='abc';
 
V.
______________________________________________________________
> Od: "Vojtěch Čihák via fpc-pascal" <fpc-pascal@lists.freepascal.org 
> <mailto:fpc-pascal@lists.freepascal.org> >
> Komu: ja...@productionautomation.net <mailto:ja...@productionautomation.net> 
> , "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org 
> <mailto:fpc-pascal@lists.freepascal.org> >
> Datum: 08.09.2020 16:21
> Předmět: Re: [fpc-pascal] TFPObjectlist example
>
______________________________________________________________
> Od: "James Richters via fpc-pascal" <fpc-pascal@lists.freepascal.org 
> <mailto:fpc-pascal@lists.freepascal.org> >
> Komu: "'FPC-Pascal users discussions'" <fpc-pascal@lists.freepascal.org 
> <mailto:fpc-pascal@lists.freepascal.org> >
> Datum: 07.09.2020 01:08
> Předmět: [fpc-pascal] TFPObjectlist example
>

James

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
<mailto:fpc-pascal@lists.freepascal.org> 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


----------

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
<mailto:fpc-pascal@lists.freepascal.org> 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to