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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news3.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> Date: Fri, 8 Jul 2005 16:02:07 +0200 Message-ID: NNTP-Posting-Date: 08 Jul 2005 16:02:07 MEST NNTP-Posting-Host: 7a31b9b9.newsread4.arcor-online.net X-Trace: DXC=HBgDFFJKNJeXiD6\]5e5en:ejgIfPPlddjW\KbG]kaMhliQbn6H@_Ei>cF23678>_k[6LHn;2LCVn7enW;^6ZC`d<=9bOTW=MNn X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:11965 Date: 2005-07-08T16:02:07+02:00 List-Id: On Fri, 08 Jul 2005 13:15:26 GMT, Matthew Heaney wrote: > "Dmitry A. Kazakov" writes: > >> That's easy. Enumerate all elements in the container [i.e. define an >> order there.] Location will be that number 1..n. > > There is no such thing as an "unordered" container (and here we're > really talking about sets and maps), But sets and maps are unordered containers. You can have a set of incomparable things. You need only "=" defined. > since then there would be no way to find anything without a linear search. This is an unrelated thing. You can invent any order you wish to implement membership test. But fundamentally yes, if the values have no identity you can hash or compare (like memory addresses), then there is nothing better than linear search. Why somebody might wish such thing is another question. > That's why we have both ordered > and hashed containers. > > The "position" of an element always relative to other elements in the > container. For an "ordered" container (Ordered_Sets, Ordered_Maps), the > position is determined by the "<" operator for elements. For a "hashed" > container (Hashed_Sets, Hashed_Maps), the position is determined from > the hash value of the element (since that determines which bucket the > element falls into). > > 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. What is the common denominator across all container types? There seems to be none. > Have you ever done any COM or DirectShow programming under Windows? A > cursor is the same as the EnumXXX class. (If I remember correctly, I > think Java also has something it refers to as an "enumerator".) DB's cursors... Or a text editor cursor. A good example, BTW. MS Visual Studio IDE handles text cursors surprisingly correct (most times.) AdaGIDE does not. So browsing the compiler messages list while editing the source code text, be prepared... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de