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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Queue implementation in Ada Date: Tue, 28 Oct 2014 11:29:28 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <8456b674-a10d-411f-bcf6-90d9638b7fc9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 28 Oct 2014 18:29:23 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="206f88a41f45fc94d25d07d064d738e2"; logging-data="30694"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HJlpeRD1tOfNH6dwtZvP9GfvSx5jqhO8=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: Cancel-Lock: sha1:44w1vejA35pvgFEk1dwjas7c62U= Xref: news.eternal-september.org comp.lang.ada:22860 Date: 2014-10-28T11:29:28-07:00 List-Id: On 10/28/2014 03:00 AM, Simon Wright wrote: > Jeffrey Carter writes: > >> If you want unsynchronized queues, you could build your own, possibly >> using Ada.Containers.Doubly_Linked_Lists (ARM A.18.3). > > I used Vectors, ARM A.18.2. Not sure why one would choose one over the > other? In the sense that both are random-access sequences, with essentially the same interface, there is none. One could build either as a wrapper around the other. Clearly any difference must be in the implementation. Given that one is named Doubly_Linked_Lists and the other adds index-based access, it's reasonable to think that the former is expected to be implemented as a linked list and the latter as an array. Since a queue experiences frequent additions to the tail and frequent deletions from the head, the linked list seems appropriate. -- Jeff Carter "My mind is a raging torrent, flooded with rivulets of thought, cascading into a waterfall of creative alternatives." Blazing Saddles 89