comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.invalid>
Subject: Re: What is the purpose of Vector.Query_Element?
Date: Mon, 27 Jul 2015 01:02:45 +0200
Date: 2015-07-27T01:02:45+02:00	[thread overview]
Message-ID: <mp3orn$fod$1@dont-email.me> (raw)
In-Reply-To: <ca22434f-8216-4cbd-a4c0-46fea8e6cc98@googlegroups.com>

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.

  reply	other threads:[~2015-07-26 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-26 22:09 What is the purpose of Vector.Query_Element? EGarrulo
2015-07-26 23:02 ` Georg Bauhaus [this message]
2015-07-27 20:12 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox