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: 103376,f2690a5e963b61b6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Date: 8 Jul 2005 07:52:21 -0700 Organization: http://groups.google.com Message-ID: <1120834341.499757.133770@g43g2000cwa.googlegroups.com> References: <1120474891.635131.216700@g44g2000cwa.googlegroups.com> <1120575076.876798.108220@g44g2000cwa.googlegroups.com> <1120583470.429264.325450@g43g2000cwa.googlegroups.com> <42cb8d21$0$22761$9b4e6d93@newsread2.arcor-online.net> <42cd064c$0$10817$9b4e6d93@newsread4.arcor-online.net> <42cda8c4$0$22780$9b4e6d93@newsread2.arcor-online.net> <1u3hh2597i4ne$.1ryetugksbmus.dlg@40tude.net> NNTP-Posting-Host: 66.162.65.162 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1120834347 9838 127.0.0.1 (8 Jul 2005 14:52:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 8 Jul 2005 14:52:27 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=66.162.65.162; posting-account=Zl1UPAwAAADEsUSm1PMMiDjihtBlZUi_ Xref: g2news1.google.com comp.lang.ada:11966 Date: 2005-07-08T07:52:21-07:00 List-Id: Dmitry A. Kazakov wrote: > On Fri, 08 Jul 2005 13:15:26 GMT, Matthew Heaney wrote: > > But sets and maps are unordered containers. This is silly. We are talking about the Ada 2005 standard container library. In that library, of course sets and maps *are* ordered. > > since then there would be no way to find anything without a linear search. > > Why somebody might wish such thing is another question. Which is exactly why they're not part of the standard library! > > An iterator (either passive or active) simply enumerates elements in > > their order as specified by the type of container they're in (either > > sort order or bucket order). > > "Their order" is the problem. Depending on its definition the order may > vary in different ways when the container is mutable. No. You're not allowed to change the key (which determimes the order) in any way that would violate the container abstraction. "Mutability" is always restricted, such that only bengin changes are allowed. > What is the common > denominator across all container types? There seems to be none. Vectors and lists are "sequence" containers, that allow you to explicitly specify the position. Sets and maps are "associative" container, that positions elements in key order. (A sorted order for "ordered" containers, and a hash order for "hashed" containers.) All containers have a consistent mechanism for iterating over elements.