From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5327159069b64d5 X-Google-Attributes: gid103376,public From: "news.oxy.com" Subject: Re: Doubly linked list. Date: 1999/01/21 Message-ID: <786ubk$jk8$1@remarQ.com>#1/1 X-Deja-AN: 435169710 References: <7560vn$21e@romeo.logica.co.uk> <781p6h$mlg$1@remarQ.com> <784c6c$d8s$1@remarQ.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: newsabuse@remarQ.com X-Trace: 916913332 HXI3FRZSOA57FC7F8C usenet77.supernews.com Organization: Posted via RemarQ, http://www.remarQ.com - Discussions start here! Newsgroups: comp.lang.ada Date: 1999-01-21T00:00:00+00:00 List-Id: Simon Wright wrote in message ... >"news.oxy.com" writes: > > >> Bc implementation of doubly linked lists is a chain of nodes each >> containing pointers to prev. and next nodes as well as reference to >> the object denoted by that node (this object may be any kind of >> object including list, tree ,buffer, queue e.t.c.). Such object may >> belong to more than one list. Moreover it may belong to any other >> kind of structure (e.g. tree, list etc.). > >The BCs work by taking copies of things (the generic parameter Item is >private), so to get the semantics you're talking about you need to use >(smart) pointers. > Yes, I agree. Function Create in BC.Suppor.Nodes makes a copy of the Item passed to it so the node after creation contains a copy of the Item, which is aliased. This means that the Node.Element, which is the copy of the Item, may be referenced from somewhere else and in this case it should not be deleted by Clear function. Proper behavior of the Clear function in this case should be to delete the node belonging to the list do not touching it's Element. After that Node.Elememt should continue to live as separate entity that does not belong any more to the deleted list. Anyway I did not investigate this issue so deep. May be someone who will be working with this more closely will analyze the BC code and test this kind of things. I was recently experimenting a little bit with controlled types and such (smart)pointers which in turn are also controlled types so I was thinking regarding above mentioned issues using such categories. As a matter of fact it gives extreme level of flexibility to the BC structures. Sorry for mixing together this two things and I am glad that you noted this inconsistency. Regards, Vladimir Olensky (Vladimir_Olensky@oxy.com) Telecommunication specialist, Occidental C.I.S. Service, Inc. ( www.oxy.com ) Moscow, Russia.