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: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Queue implementation in Ada Date: Tue, 28 Oct 2014 19:25:20 +0000 Organization: A noiseless patient Spider Message-ID: References: <8456b674-a10d-411f-bcf6-90d9638b7fc9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="e614caa3bbcdcdac946afd88f128a08d"; logging-data="10929"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PrarrIopRWIHrRSyP9RSBPtb1q6frop8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:+4kIaUnBHL0cAwmEO/bvtRrHU5c= sha1:4m1hhr5xGOOA8H4n5Qp1wG5dexE= Xref: news.eternal-september.org comp.lang.ada:22865 Date: 2014-10-28T19:25:20+00:00 List-Id: Jeffrey Carter writes: > 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. Good point. I've been put off Doubly_Linked_Lists because I would usually have been quite happy with singly linked lists. But really, what difference does it make if all you're doing is implementing a Queue!