comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: generic arrays?
Date: Fri, 20 Feb 2004 17:03:26 GMT
Date: 2004-02-20T17:03:26+00:00	[thread overview]
Message-ID: <y5rZb.1696$aT1.243@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <f4qZb.72$b_4.18@newsfe1-win>

chris wrote:

> Is it possible to do something like the following?
> 
> generic
>   NI : Positive;
> package P is
>   type IV is array (1..NI) of float;
> end P;
> 
> generic
>   type X is ...
> package T is
>    type TP is record
>      A : X;
>    end TP;
> end T;
> 
> with the ability to make the type of X = type of IV?  I want to 
> instansiate T with IV after instantiating P, but don't know what to make 
> X.  Is there any way to avoid using an access type to hold X in the 
> record TP?  (in the case where type x is an unconstrained array of floats).

I must be misunderstanding something, because this seems easy and basic:

generic
    type X is [limited] private;
package T is
...

with P;
with T;
procedure W is
    package New_P is new P (Ni => 10);
    package New_T is new T (X => New_P.Iv);

    Q : New_T.Tp;
...

-- 
Jeff Carter
"C++ is like jamming a helicopter inside a Miata
and expecting some sort of improvement."
Drew Olbrich
51




  reply	other threads:[~2004-02-20 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-20 15:58 generic arrays? chris
2004-02-20 17:03 ` Jeffrey Carter [this message]
2004-02-22 16:44   ` chris
2004-02-20 21:06 ` Jim Rogers
replies disabled

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