[Lazarus] How to iterate through a TAvgLvlTree
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Mar 16 11:06:49 CET 2012
On Fri, 16 Mar 2012 20:47:15 +1100
Alexander Klenin <klenin at gmail.com> wrote:
> On Fri, Mar 16, 2012 at 19:36, Mattias Gaertner
> <nc-gaertnma at netcologne.de> wrote:
> >> Is it possible to iterate through all items in a TAvgLvlTree? I
> >> couldn't find an easy method for doing that.
> >
> > for Node in Tree do
>
> By the way, I think you are using TAvgLvlTree rather often,
> so did you ever wanted another traversal order besides the default one?
Of course.
> You replaced my proposal of extending the for..in loop on the wiki
> by an example implementing it using the current syntax.
>
> So, I am interested -- did you actually use you implementation?
Yes.
> What is your opinion -- did it work well for you?
Yes.
> In particular, I am interested in the memory management issues --
> how is enumerator instance freed in your example?
If you mean the fpc enumerators: They are freed by compiler magic after
the loop.
> Finally, do you feel the need for the remaining extension proposal --
> namely, getting the index from enumerator?
An index is hardly needed for an AVL tree.
Mattias
More information about the Lazarus
mailing list