comp.lang.ada
 help / color / mirror / Atom feed
* Using Access Types for a simple solution
@ 2016-07-25 13:35 ldries46
  2016-07-25 14:28 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ldries46 @ 2016-07-25 13:35 UTC (permalink / raw)


Let me first explain the problem. I do have a matrix of records

type Box is record
   ...
   ...
end record

Grid : array( 1 .. N,  1 .. M) of Box;

Now I must do something with a random set out of elements from the matrix. I 
would like to create an array of pointers to the elements of the matrix so 
that I can use these elements and file the changes directly if the array. So 
I created a type:

type Box_Access is access all Box;

and make an array

Box_Array : array(1 .. Q) of Box_Acess;

When try to use that in a simple statement

Box_Array(n) := Grid(n1, n2)'Access;

I get the error (only for this statement): prefix of 'Access attribute must 
be aliased.

I tried:

Grid : aliased array( 1 .. N,  1 .. M) of Box;

But that also gives the same error.
I cannot imagine that what I want is not possible in Ada as I can realise it 
in C++ so I do miss something.

L. Dries








^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-26 18:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 13:35 Using Access Types for a simple solution ldries46
2016-07-25 14:28 ` Dmitry A. Kazakov
2016-07-25 15:27 ` ldries46
2016-07-25 21:39   ` rieachus
2016-07-26 18:16 ` Aurele

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