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!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) References: <11b4d.3849$d5.30042@newsb.telia.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, 24 Sep 2004 03:06:10 GMT NNTP-Posting-Host: 64.185.133.124 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1095995170 64.185.133.124 (Thu, 23 Sep 2004 20:06:10 PDT) NNTP-Posting-Date: Thu, 23 Sep 2004 20:06:10 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:4079 Date: 2004-09-24T03:06:10+00:00 List-Id: Brian May writes: > The following code (or something like it), I believe (not tested), > should reduce the line count (and complexity) of the above: > > procedure Insert (Word : String) is > I : Wordcount_Maps.Iterator_Type; > B : Boolean; > > begin -- Insert > Insert (Map, To_Lower (Word), 0, I, B); > Replace_Element(I, Element(I) + 1); > end Insert; Yes, that's true, but the point of the original example was to show how to modify the element in-place, as you do for C++. Clearly, in the case of an object of type Integer, you don't really need to modify the object in place, and your solution above is perfectly adequate (and simpler too). Support for in-place modification is really provided for composition of containers. So for example, if you have a container whose elements are another container, then you need in-place modification to manipulate the (container) element. -Matt