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!news4.google.com!news.glorb.com!atl-c03.usenetserver.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. 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> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Jul 2005 13:15:26 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1120828526 24.149.57.125 (Fri, 08 Jul 2005 06:15:26 PDT) NNTP-Posting-Date: Fri, 08 Jul 2005 06:15:26 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:11963 Date: 2005-07-08T13:15:26+00:00 List-Id: "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), since then there would be no way to find anything without a linear search. 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). 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".)