[fpc-pascal] List of integers? Any class available in RTL or FCL to help?

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Sun Dec 4 10:43:43 CET 2016


The code I'm working on often needs a list of integers (actually uint16,
int16 etc, but Integer should do). I would normally use an array, but I
have no idea how many items I'll need beforehand. Obviously I could take
15 minutes and implement my own TIntList class or something, but that
got me thinking... Surely the RTL or FCL must have such simple container
types already? If so, has anybody got suggestions?  I could use TList
and abuse the fact that it stores Pointers, which in affect is good
enough to store Integer data, but is there a container that doesn't use
such abuse?

I could use Generics, but I really don't like generics much - they just
don't look pascal-like, but maybe I should simply get over that and just
start using them.

I would still like to hear of the RTL or FCL has other container I could


fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp

More information about the fpc-pascal mailing list