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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,8e11100f675ea2df X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.96.231 with SMTP id dv7mr2800281wib.6.1357902996811; Fri, 11 Jan 2013 03:16:36 -0800 (PST) Path: o9ni6599wio.1!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.131.MISMATCH!xlned.com!feeder3.xlned.com!news.astraweb.com!border6.a.newsrouter.astraweb.com!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.x-privat.org!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: asynchronous task communication Date: Tue, 8 Jan 2013 22:26:26 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <1c2dnd5E6PMDR33NnZ2dnUVZ_sednZ2d@earthlink.com> <50e18094$0$6583$9b4e6d93@newsspool3.arcor-online.net> <7NednS4s2oukfXzNnZ2dnUVZ_oadnZ2d@earthlink.com> <7cudnYloBfQDw3_NnZ2dnUVZ_rKdnZ2d@earthlink.com> <6bqdndEYjoxeGHnNnZ2dnUVZ_sadnZ2d@earthlink.com> Mime-Version: 1.0 Injection-Date: Tue, 8 Jan 2013 22:26:26 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="dfff62e1e537b55df42008571c03e0fe"; logging-data="32487"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+65f+XuPh0cKgWfkO0wroG20Auw9ZUahM=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:isRw9C2CNkFEiXuGYaUMwQkk4h4= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2013-01-08T22:26:26+00:00 List-Id: On Tue, 08 Jan 2013 10:12:30 -0700, Jeffrey Carter wrote: > On 01/08/2013 05:02 AM, Brian Drummond wrote: >> >> And the index is a Cursor type. > > No. The index is a discrete type chosen by the user. Cursor is a private > type defined by the package. Both serve to represent a "location" in the > array. The context was Ada.Containers, where other forms of container use Cursor for indexing; I've been using List recently so it seemed odd that Vector has both index and cursor - but I stand corrected, they do appear to be separate, with overlapping functionality. >> So, holding onto a cursor would be unsafe (i.e. no longer refer to the >> original object) after an "insert" operation, possibly earlier in the >> vector? > > ... if you insert a new component before > the existing item at index 3, then all the components after the new > component will shift up, and the existing item will then be at index 4. > > One would think that a Cursor would behave similarly. Question answered; whether it raises PE or follows Index in losing its place, Cursor cannot be used as a link to an object in the presence of Insert or Remove operations. There is quite a lot of magic already in Ada.Containers (in the sense of making storage management easy and reliable) - that would be a bit too much to ask. (Not fundamentally impossible, but unlikely to be efficient) Underlying point : as Dmitry says, Vector is the wrong abstraction for some (most?) graphs. - Brian