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,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: 23 Sep 2004 08:59:38 -0700 Organization: http://groups.google.com Message-ID: <1ec946d1.0409230759.17a786c6@posting.google.com> References: <11b4d.3849$d5.30042@newsb.telia.net> NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1095955179 25909 127.0.0.1 (23 Sep 2004 15:59:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 23 Sep 2004 15:59:39 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:4021 Date: 2004-09-23T08:59:38-07:00 List-Id: Georg Bauhaus wrote in message news:... > Kevin Cline wrote: > : begin -- Insert > : Insert (Map, To_Lower (Word), 0, I, B); > : declare E : Wordcount_Maps.Element_Subtype renames To_Access > : (I).all; > : begin > : E := E + 1; > : end; > : end Insert; > > Is the intention to first store a 0 with word, and then > to increment the value stored at word? Yes. That's exactly how the index operator works in C++ (which is deliberate). This is the most efficient technique, since the search is performed only one time. Note that in the AI-302 API, you use a slightly different technique: declare procedure Increment_Count (W : in String; N : in out Natural) is begin N := N + 1; end; begin Update_Element (C, Increment_Count'Access); end; See the link in my previous post to the Ada 2005 version of wordcount.adb at the tigris site. -Matt