Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

Author Topic: [Solved] Do we have a TIntegerList tucked away anywhere?  (Read 6429 times)

Mike.Cornflake

• Hero Member
• Posts: 1260
[Solved] Do we have a TIntegerList tucked away anywhere?
« on: August 06, 2011, 04:26:41 am »
G'day,

I'm looking for a TIntegerList - what I need is something that can sort a list of integers, and that I can call .IndexOf (or equiv) to find the index of a number in the list, and that I can call .Add or .Delete as required.  And I'd like the sort to be a quicksort or better.  As a quick hack to tide me over I'm using a TStringlist.  I want to get past the all the string to integer conversions though.

Before I sit down and actually write the TIntegerList I thought I'd check to see if it we already have one in either FPC or LCL.   Couldn't find one by that name, so thought I'd ask :-)
« Last Edit: August 06, 2011, 08:04:21 pm by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

Leledumbo

• Hero Member
• Posts: 8757
• Programming + Glam Metal + Tae Kwon Do = Me
Re: Do we have a TIntegerList tucked away anywhere?
« Reply #1 on: August 06, 2011, 05:44:05 am »
Code: [Select]
`uses  fgl;type// for {\$mode objfpc}  TIntegerList = specialize TFPGList<Integer>;// for {\$mode delphi}  TIntegerList = TFPGList<Integer>;// WARNING: you can only use one compilation mode per unit, so only one syntax type per unit`

Mike.Cornflake

• Hero Member
• Posts: 1260
Re: Do we have a TIntegerList tucked away anywhere?
« Reply #2 on: August 06, 2011, 06:38:05 am »
Simply superb!  Not a syntax I'm familiar with - something new to play with :-)   Looks obvious enough.

Many thanks :-)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines