[fpc-pascal] list classes or arrays in FPC
Joao Morais
post at joaomorais.com.br
Mon Oct 1 18:26:21 CEST 2007
Graeme Geldenhuys wrote:
> Anybody know what list classes or arrays are available in FPC? I know
> the standard TObjectList and TStringList, but I'm pretty sure there
> must be more 'not so well known' lists available.
contnrs unit?
> I'm busy implementing a Objects[ARow, ACol] property for fpGUI's
> StringGrid component and would like to read up on what efficient list
> classes or arrays I could possibly use. I'll only be storing Pointers
> and the StringGrid will *not* be maintaining the lifespan of the
> Objects being stored. Only their pointers will be stored, so I guess
> it doesn't need to be a complex list class or pointer array.
You could use variant arrays or two dynamic arrays, but I personally
prefer classes. This approach could be reached using a TObjectList
instance to hold TObjectList objects, the getter should have something
like this:
Result := ((FObjList[ARow] as TObjectList)[ACol] as TYourTargetClass);
Hth.
--
Joao Morais
More information about the fpc-pascal
mailing list