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!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 11 Jul 2005 13:35:48 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada 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> <42ce5856$0$22762$9b4e6d93@newsread2.arcor-online.net> <1o398w3zo2zf1$.f1f7tukylueo$.dlg@40tude.net> Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Date: Mon, 11 Jul 2005 13:38:56 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-wTswTs07NN/KdJj4NTRkuyfd5aCLeOvbA5DlO1BSEg/5S109T4t7u6A9VphWgSyRBqPjOOLfLALvbd9!ErYU36jWnHeTD/Az+92t38qq4OxUBHrZPorfoJ7VGm3Uv/Vg84lahonhT/Ur5Jq4O+qqU/yj8Vd4 X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.31 Xref: g2news1.google.com comp.lang.ada:12000 Date: 2005-07-11T13:38:56-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:nmv39ipirsbg$.1or742g96p5km.dlg@40tude.net... > > The abstract view of iteration is that it produces *every* element of the > > container, and no others, in *some* unspecified order. That applies both the > > the passive iterator Iterate and the cursor based routines like Next. > > An unspecified order is still an order. What could be said about that > unspecified order? Nothing. That's the meaning of "unspecified"! The implementation can use any convinient order. > May the order vary for a constant container? There is no such thing as a constant container. You can declare a container object constant, but that doesn't make the container constant. > How does it when the container gets changed? That's irrelevant. If the container is changed, cursor iteration may fail (passive iteration would raise Program_Error; that's part of the contract of all of the containers). ... > > Of course, specific containers do require a specific order, and *then* you > > can rely upon it. But not in a generic algorithm. > > A generic algorithm is just a class-wide procedure. The problem is the > contract of the class. If iteration is in the contract, then its behavior > must be defined. So that the correctness of the algorithm would be > independent on any possible implementation. If it is outside, then there > must be no [easy] way to use it. For a passive iterator, the contract is that each element is visited exactly once, in an unspecified order. Signficant changes to the container during a passive iterator are *not* allowed (they raise Program_Error). Thus, the order is irrelevant. Randy.