From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: limited agregate and limited components default initialization
Date: Mon, 2 Apr 2018 21:59:17 +0200
Date: 2018-04-02T21:59:17+02:00 [thread overview]
Message-ID: <p9u22j$rbh$1@gioia.aioe.org> (raw)
In-Reply-To: 0db6a65f-9c14-483d-98f9-9fa40e37253f@googlegroups.com
On 2018-04-02 21:46, Jere wrote:
> On Monday, April 2, 2018 at 2:51:00 PM UTC-4, Dmitry A. Kazakov wrote:
>> On 2018-04-02 20:19, Jere wrote:
>>
>>> Something else unrelated to your question, but that I just noticed: Assuming
>>> you could have gotten a list definition that you were happy with, there is
>>> still a very serious problem with it. Doubly linked lists (ones that use
>>> both Next and Prev/Pred) are susceptible to "circular references" when using
>>> reference counting smart pointers. You would need to use a weak reference
>>> based smart pointer for one of the two (either Next or Prev/Pred, whichever
>>> you prefer).
>>>
>>> -- very simple/silly example
>>> type Node is
>>> Value : Item_Type;
>>> Next : Smart_Pointer_Type;
>>> Prev : Weak_Smart_Pointer_Type;
>>> end Node;
>>
>> This is still circular. Weak/strong references work only in hierarchical
>> structures. If a doubly-linked list must deploy them then it should be
>> the head holding references to all nodes. It does not make much sense
>> though.
>>
> Nope, not circular at all unless you connect Tail to Head (which isn't
> the normal use case).
Usually I do, it makes operations faster and easier because links are
never null. I can even have not-null constraint on the links.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2018-04-02 19:59 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-31 23:36 limited agregate and limited components default initialization Jean-Claude Rostaing
2018-04-01 0:52 ` Jere
2018-04-01 1:12 ` Jere
2018-04-01 1:16 ` Jean-Claude Rostaing
2018-04-01 1:34 ` Jere
2018-04-01 2:07 ` Jean-Claude Rostaing
2018-04-01 2:40 ` Jere
2018-04-01 2:54 ` Jere
2018-04-01 3:14 ` Jere
2018-04-01 3:31 ` Jere
2018-04-01 9:32 ` Jacob Sparre Andersen
2018-04-01 12:58 ` Jean-Claude Rostaing
2018-04-01 13:33 ` Dmitry A. Kazakov
2018-04-01 15:46 ` Jean-Claude Rostaing
2018-04-01 15:53 ` Jean-Claude Rostaing
2018-04-01 15:54 ` Jean-Claude Rostaing
2018-04-01 21:31 ` Dmitry A. Kazakov
2018-04-02 3:44 ` Randy Brukardt
2018-04-02 11:25 ` Jean-Claude Rostaing
2018-04-02 12:11 ` Dmitry A. Kazakov
2018-04-02 12:15 ` Jean-Claude Rostaing
2018-04-02 21:37 ` Randy Brukardt
2018-04-03 17:01 ` Jeffrey R. Carter
2018-04-05 10:27 ` AdaMagica
2018-04-02 3:42 ` Randy Brukardt
2018-04-01 22:52 ` Jean-Claude Rostaing
2018-04-01 23:36 ` Jean-Claude Rostaing
2018-04-01 23:39 ` Jean-Claude Rostaing
2018-04-02 18:19 ` Jere
2018-04-02 18:50 ` Dmitry A. Kazakov
2018-04-02 19:46 ` Jere
2018-04-02 19:59 ` Dmitry A. Kazakov [this message]
2018-04-02 21:03 ` Jean-Claude Rostaing
2018-04-03 8:14 ` Dmitry A. Kazakov
2018-04-03 1:27 ` Dennis Lee Bieber
2018-04-02 22:39 ` Robert I. Eachus
2018-04-03 18:18 ` Jean-Claude Rostaing
2018-04-03 18:28 ` Jean-Claude Rostaing
2018-04-03 19:18 ` Jeffrey R. Carter
2018-04-03 19:25 ` Jean-Claude Rostaing
2018-04-03 20:12 ` Jeffrey R. Carter
2018-04-03 22:37 ` Jean-Claude Rostaing
2018-04-04 2:18 ` Jere
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox