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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1f8b4cce7e72b123,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-25 21:45:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!feed2.onemain.com!feed1.onemain.com!nntp3.onemain.com.POSTED!not-for-mail From: Eric G. Miller Newsgroups: comp.lang.ada Subject: Arrays and Access types... Message-ID: <20011025214647.2788a60b.egm2@jps.net> X-Newsreader: Sylpheed version 0.6.3 (GTK+ 1.2.10; i386-debian-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Thu, 25 Oct 2001 21:46:47 -0700 NNTP-Posting-Host: 216.119.36.160 X-Complaints-To: abuse@onemain.com X-Trace: nntp3.onemain.com 1004071195 216.119.36.160 (Fri, 26 Oct 2001 00:39:55 EDT) NNTP-Posting-Date: Fri, 26 Oct 2001 00:39:55 EDT Xref: archiver1.google.com comp.lang.ada:15212 Date: 2001-10-25T21:46:47-07:00 List-Id: 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! ... The first is allowed, whereas I can't figure out how to make second an access type assignment (is it possible?). What I want to do is progressively subset the array, and I won't know exactly how it'll get broken up until runtime. The original array will get divvied up into smaller and smaller slices of an earlier slice (the remaining can be discarded). If there's a way to do this with regular arrays (no access types), that'll work. I wanted to minimize the number of "new" arrays -- I'm not quite comfortable with how/when to use Unconstrained_Deallocation yet... -- Eric G. Miller