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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: What is the purpose of Vector.Query_Element? Date: Mon, 27 Jul 2015 01:02:45 +0200 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 26 Jul 2015 23:01:11 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="16141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/q7/MvcimKzE3zqTZZKStPnUh4udND9g=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: Cancel-Lock: sha1:jwiIlukcpPxfRMZlGoOWlL8qkHc= Xref: news.eternal-september.org comp.lang.ada:27022 Date: 2015-07-27T01:02:45+02:00 List-Id: On 27.07.15 00:09, EGarrulo wrote: > The package that defines Vector provides this procedure: > > procedure Query_Element > (Container : in Vector; > Index : in Index_Type; > Process : not null access procedure (Element : in Element_Type)); > > Why is this procedure provided? To avoid copying. "These procedures provide in situ access to an element." -- Ada Rationale 2005 Ch 8.2. http://www.adaic.org/resources/add_content/standards/05rat/html/Rat-8-2.html > Isn't `Query_Element (Vector, Index, Process'Access)` the same as `Process (Element (Vector, Index))`? Maybe the difference is a little more apparent when considering Update_Element.