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!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Date: 20 Jul 2005 11:33:05 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1120474891.635131.216700@g44g2000cwa.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> <1120834341.499757.133770@g43g2000cwa.googlegroups.com> <1121093867.964444.232420@g14g2000cwa.googlegroups.com> <42d2bc2d$0$20148$9b4e6d93@newsread2.arcor-online.net> <1121134291.379399.79460@z14g2000cwz.googlegroups.com> <42d46b51$0$18005$9b4e6d93@newsread4.arcor-online.net> <42d6ef47$0$7644$9b4e6d93@newsread2.arcor-online.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1121873585 26888 192.74.137.71 (20 Jul 2005 15:33:05 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 20 Jul 2005 15:33:05 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:3702 Date: 2005-07-20T11:33:05-04:00 List-Id: "Randy Brukardt" writes: > "Mikhail Terekhov" wrote in message > news:gb_Ce.8815$LC6.6336@fe06.lga... > .... > > That is wonderful! Almost any example of using cursor doesn't really > > need cursors. Why this burden then? > > Not at all true. Consider iterating through a sequence of characters, and producing a new, transformed sequence. If each character is independent of the others, then Iterate is simplest. For example, convert each character to upper case. But if the characters depend on what comes before/after, using cursors can make the code simpler. For example, replace all sequences of one or more blanks with a single blank. You can do that with Iterate, but then you have to keep flags remembering what came before. Using cursors, the code is simplified. By the way, Iterate can be implemented in terms of cursors, and cursors can be implemented in terms of Iterate. So in some sense they are equivalent, and any data structure for which one makes sense, the other makes sense. There are data structures for which neither can be supported. - Bob