From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Arrays and Access types...
Date: Fri, 26 Oct 2001 23:32:38 GMT
Date: 2001-10-26T23:32:38+00:00 [thread overview]
Message-ID: <3BD9F28F.5AB29716@acm.org> (raw)
In-Reply-To: 20011025214647.2788a60b.egm2@jps.net
"Eric G. Miller" wrote:
>
> New to Ada and trying to figure out how to deal with arbitrary
> slices of arrays. I defined an array type and an access type
> for it, but I can't seem to figure out how to take a slice of
> the array and assign that slice to an access type.
>
> Type is like:
>
> type My_Array is array (Positive range <>) of Integer;
> type My_Array_Ref is access My_Array;
>
> ... in body ...
>
> left, right, start : My_Array_Ref;
>
> begin
> start := new My_Array (1 .. 200);
> left := start(start'first .. 100); -- that doesn't work!
I doubt that you really need access types/values at all. Since all the
other responses seem to be overkill, I would suggest something like
Start : My_Array (1 .. 200);
...
begin
declare
Left : [constant] My_Array := Start (Start'First .. 100);
begin
...
--
Jeff Carter
"I wave my private parts at your aunties."
Monty Python & the Holy Grail
next prev parent reply other threads:[~2001-10-26 23:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-26 4:46 Arrays and Access types Eric G. Miller
2001-10-26 5:39 ` James Rogers
2001-10-26 6:45 ` Eric G. Miller
2001-10-26 16:40 ` James Rogers
2001-10-26 6:14 ` tmoran
2001-10-26 14:26 ` Ted Dennison
2001-10-26 19:31 ` chris.danx
2001-10-26 23:32 ` Jeffrey Carter [this message]
2001-10-27 1:08 ` Eric G. Miller
2001-10-27 2:09 ` DuckE
2001-10-27 4:23 ` Steven Deller
2001-10-27 18:30 ` Eric G. Miller
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox