[Lazarus] How to iterate through a TAvgLvlTree

Alexander Klenin klenin at gmail.com
Fri Mar 16 11:17:57 CET 2012


On Fri, Mar 16, 2012 at 21:06, Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
> 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.

So perhaps this fact should be added to the manual?
http://www.freepascal.org/docs-html/ref/refsu50.html

-- 
Alexander S. Klenin




More information about the Lazarus mailing list