comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Trying to declare an array from the heap from inside a record declaration
Date: Wed, 8 Nov 2017 18:22:12 +0100
Date: 2017-11-08T18:22:12+01:00	[thread overview]
Message-ID: <otveg5$pah$1@dont-email.me> (raw)
In-Reply-To: <1c20fe22-ba3c-4db4-a18d-c922e3d04de5@googlegroups.com>

On 11/08/2017 10:32 AM, Jerry wrote:
> 
> type foo(M, N : Integer) is
>      record
>          y : Real_Vector(M .. N);
>          x_Ptr : Real_Vector_Access := new Real_Vector(M .. N);
>              x : Real_Vector renames x_Ptr.all;
>      end record;

You might want to move the allocation up a level:

type Foo (M : Integer; N : Integer) is record
    X : Real_Vector (M .. N);
end record;
type Foo_Ptr is access Foo;

F_Ptr : constant Foo_Ptr := new Foo (M, N);

F     : Foo renames F_Ptr.all;

-- 
Jeff Carter
"I unclog my nose towards you."
Monty Python & the Holy Grail
11


  parent reply	other threads:[~2017-11-08 17:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08  9:32 Trying to declare an array from the heap from inside a record declaration Jerry
2017-11-08 13:08 ` AdaMagica
2017-11-08 17:22 ` Jeffrey R. Carter [this message]
2017-11-10  7:44 ` Jerry
2017-11-10  8:10   ` AdaMagica
2017-11-14 15:19     ` Robert Eachus
replies disabled

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