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!z14g2000cwz.googlegroups.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Date: 12 Jul 2005 08:35:24 -0700 Organization: http://groups.google.com Message-ID: <1121182524.007719.77090@z14g2000cwz.googlegroups.com> References: <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> <1121093807.949660.274060@g44g2000cwa.googlegroups.com> <1121124248.600055.292320@f14g2000cwb.googlegroups.com> <1121137531.752285.44280@g44g2000cwa.googlegroups.com> <946e7$42d3c64d$4995421$28449@ALLTEL.NET> <1121179909.262566.192270@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: 66.162.65.162 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1121182530 12948 127.0.0.1 (12 Jul 2005 15:35:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 12 Jul 2005 15:35:30 +0000 (UTC) In-Reply-To: <1121179909.262566.192270@o13g2000cwo.googlegroups.com> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=66.162.65.162; posting-account=Zl1UPAwAAADEsUSm1PMMiDjihtBlZUi_ Xref: g2news1.google.com comp.lang.ada:12015 Date: 2005-07-12T08:35:24-07:00 List-Id: MMM wrote: > Exactly. But the original claim was that "unordered" containers do not > exist. It depends of course on how one defines "unordered." I use the term "unordered" to refer to a set (or map) implemented using some kind of sequential container (a list, say). The only way to find an element is by performing a linear search. An "ordered" set is implemented using a data structure that allows you to find an element in better than O(n) time. Using that criterion, then both the Hashed_Set and Ordered_Sets are "ordered." The order isn't specified for a Hashed_Set, but its elements aren't organized willy-nilly either (qua list). A hashed container is implemented using a hash table, and so its time complexity is O(1), and it is in that sense that I refer to a hashed container as being "ordered." Part of the confusion stems from the fact that other languages like C++ use the term "sorted" to refer to what the Ada standard calls Ordered_Maps and Ordered_Sets. (My original API actually used the terms Sorted_Maps and Sorted_Sets.) The "sorted vs. hashed" nomenclature probably makes it less confusing to say that the associative containers are both "ordered," but it's not that big a deal as long as we know we're refering to associative containers, and understand that a hashed container has some order, but that its order isn't specified.