Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-10

List of Integer/Double etc

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

Hi, I'm wondering if the rtl or a standard package includes classes for handling lists of Integer, Double, and other types. Similar to TStringList, but for numerical types.

Thanks in advance,
Leonardo M. Ramé
http://leonardorame.blogspot.com

Sven Barth
to Leonardo M. Ramé
Leonardo M. Ramé wrote
Hi, I'm wondering if the rtl or a standard package includes classes for handling lists of Integer, Double, and other types. Similar to TStringList, but for numerical types.

Using generics this is easy:

=== source begin ===

uses
   fgl;
type
   TIntegerList = specialize TFPList<Integer>;
   TDoubleList = specialize TFPList<Double>;

=== source end ===

Regards,
Sven

Leonardo M. Ramé
to Sven Barth
Show quoted text 27 lines
________________________________ From: Sven Barth To: Sent: Wednesday, October 12, 2011 9:12 AM Subject: Re: [fpc-pascal] List of Integer/Double etc Am 12.10.2011 14:08, schrieb Leonardo M. Ramé: > Hi, I'm wondering if the rtl or a standard package includes classes for > handling lists of Integer, Double, and other types. Similar to > TStringList, but for numerical types. Using generics this is easy: === source begin === uses   fgl; type   TIntegerList = specialize TFPList<Integer>;   TDoubleList = specialize TFPList<Double>; === source end === Regards, Sven

Thanks, I'll try that.

Leonardo M. Ramé
http://leonardorame.blogspot.com

Sven Barth
to Leonardo M. Ramé
Leonardo M. Ramé wrote 30 lines
> ________________________________ > From: Sven Barth > To: > Sent: Wednesday, October 12, 2011 9:12 AM > Subject: Re: [fpc-pascal] List of Integer/Double etc > > Am 12.10.2011 14:08, schrieb Leonardo M. Ramé: >> Hi, I'm wondering if the rtl or a standard package includes classes for >> handling lists of Integer, Double, and other types. Similar to >> TStringList, but for numerical types. > > Using generics this is easy: > > === source begin === > > uses > fgl; > > type > TIntegerList = specialize TFPList<Integer>; > TDoubleList = specialize TFPList<Double>; > > === source end === > > Regards, > Sven > Thanks, I'll try that.

Please note: it needs to be "TFPGList" and not "TFPList". I missed a character there.

Regards,
Sven