comp.lang.ada
 help / color / mirror / Atom feed
From: "ldries46" <bertus.dries@planet.nl>
Subject: Using Access Types for a simple solution
Date: Mon, 25 Jul 2016 15:35:43 +0200
Date: 2016-07-25T15:35:43+02:00	[thread overview]
Message-ID: <579615c5$0$20671$e4fe514c@news.kpn.nl> (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








             reply	other threads:[~2016-07-25 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25 13:35 ldries46 [this message]
2016-07-25 14:28 ` Using Access Types for a simple solution Dmitry A. Kazakov
2016-07-25 15:27 ` ldries46
2016-07-25 21:39   ` rieachus
2016-07-26 18:16 ` Aurele
replies disabled

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