[fpc-devel] Re: [Lazarus] How to iterate through a TAvgLvlTree

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Fri Mar 16 11:36:08 CET 2012

Can I add a routine to access the AvgLvlTree as an array? To make it a
better substitute to TFPList in objects which offer an indirect
interface to the internal list, such as TLazAccessibleObject.

My idea is defining:
Index zero = Tree.FindLowest
Indez Count-1= Tree.FindHighest

On each access store the last accessed node and if the next call wants
a node index=oldindex+1 or -1 then just use:


Because almost always I use the array access only to iterate in a loop.

Non-ordened access ofcourse would be slow because it would require a
loop till the index is found.

Felipe Monteiro de Carvalho

More information about the fpc-devel mailing list