auto classes and finalizers
Sean Kelly
sean at f4.ca
Thu Apr 6 11:50:23 PDT 2006
kris wrote:
> Jarrett Billingsley wrote:
>>
>> Hmm. 'auto' works well and good for classes whose references are
>> local variables, but .. what about objects whose lifetimes aren't
>> determined by the return of a function?
>>
>> I.e. the Node class is used only in LinkedList. When a LinkedList is
>> killed, all its Nodes must die as well. Since the Node references are
>> kept in the LinkedList and not as local variables, there's no way to
>> specify 'auto' for them.
>
> Heck, the LinkedList dtor /cannot/ rely on the nodes being valid if they
> are also managed by the GC :)
>
> So, as I understand it, one cannot legitimately execute that example.
...unless the LinkedList has a deterministic lifetime :-)
Sean
More information about the Digitalmars-d
mailing list