On Fri, 16 Mar 2012 20:47:15 +1100 Alexander Klenin <[email protected]> wrote:
> On Fri, Mar 16, 2012 at 19:36, Mattias Gaertner > <[email protected]> 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 -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
