comp.lang.ada
 help / color / mirror / Atom feed
From: Eric G. Miller <egm2@jps.net>
Subject: Re: Arrays and Access types...
Date: Thu, 25 Oct 2001 23:45:15 -0700
Date: 2001-10-25T23:45:15-07:00	[thread overview]
Message-ID: <20011025234515.5dfa2af1.egm2@jps.net> (raw)
In-Reply-To: 3BD8F70E.3667B286@worldnet.att.net

On Fri, 26 Oct 2001 05:39:09 GMT, James Rogers <jimmaureenrogers@worldnet.att.net> wrote:

> Unlike C, Ada arrays are not directly related to access types or
> pointers. 

So, I am learning...

> There are several ways to solve your problem. My personal approach
> would be to create a record structure to keep track of your slicing
> on a single array element. One such data structure follows:

I think this type of approach would work, and would avoid multiple
"new" calls.  For the particular problem I'm looking at, I will
have three subsets for each iteration.  I think the other posters
suggestion to use a recursive function would work well since the
initial data size is fairly small and the algorithm will find
the answer in 5 calls or less.

I'm a little confused about the use of generics and what it is
providing here... Is it for the "Element" type, so's the
package doesn't have to care what type of thing it is?  If that's
the case, does the "outside world" have to declare a subtype of
Element to use this generic? or will any type do?  I haven't
really gotten to generics yet (just working on the basics at
the moment).

> --- Slicable array package
> generic
>    Max_Size : Positive;
>    type Element is private;
> package Slicing_Array is
>    
>    subtype Array_Index is Positive range 1..Max_Size;
>    type Element_Array is array(Array_Index range <>) of Element;
>    type Slicable_Array is private;

<snipped>

-- 
Eric G. Miller <egm2@jps.net>



  reply	other threads:[~2001-10-26  6:45 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 [this message]
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
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