comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: Ada.Containers.Indefinite_Holders in GNAT and Ada2012
Date: Sun, 10 Aug 2014 16:06:21 +0300
Date: 2014-08-10T16:06:21+03:00	[thread overview]
Message-ID: <ls7qob$9cm$1@speranza.aioe.org> (raw)
In-Reply-To: ls5tkt$6g2$1@speranza.aioe.org

Victor Porton wrote:

> Victor Porton wrote:
> 
>> I tried to write:
>> 
>> Element(Object)'Access;
>> 
>> for "Object" being a value of an instance of
>> Ada.Containers.Indefinite_Holders.
>> 
>> This does not work because the return type of Element is not aliased.
> 
> By the way, does it makes sense in the next Ada specification to make the
> return type of "Element" function aliased?

Hm, my idea was wrong: Element may return a copy instead of the actual 
element.

However I propose to add Element_Access to next RM which would return access 
to the element in the container.

One (real World!) usage for this: Interfaces.C.Strings.To_Chars_Ptr applied 
to an element in an indefinite holder of type char_array.

>> Then I tried:
>> 
>> Reference(Object).all'Access;
>> 
>> This does not work because in GNAT 4.9 a-coinho.ads source file is not up
>> to date with Ada2012 and there are no Reference function here.
>> 
>> My questions:
>> 
>> 1. How long to wait for GNAT to work with this? (in which GNAT version?)
>> 
>> 2. In a conforming Ada2012 compiler `Reference(Object).all'Access;` is
>> semantically correct, isn't it?
>> 
>> In the meantime, I need to write for my private use a container similar
>> to Ada.Containers.Indefinite_Holders for aliased objects by myself :-(

-- 
Victor Porton - http://portonvictor.org

  reply	other threads:[~2014-08-10 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09 19:25 Ada.Containers.Indefinite_Holders in GNAT and Ada2012 Victor Porton
2014-08-09 19:43 ` Victor Porton
2014-08-10 13:06   ` Victor Porton [this message]
2014-08-10 15:32     ` Simon Wright
2014-08-11 11:01     ` AdaMagica
2014-08-11 15:38     ` Adam Beneschan
2014-08-11 23:58   ` Randy Brukardt
2014-08-09 21:54 ` Simon Wright
replies disabled

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