comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Trying to declare an array from the heap from inside a record declaration
Date: Wed, 8 Nov 2017 05:08:28 -0800 (PST)
Date: 2017-11-08T05:08:28-08:00	[thread overview]
Message-ID: <3de565d1-b892-462f-8e9b-89ccbd7cb9cb@googlegroups.com> (raw)
In-Reply-To: <1c20fe22-ba3c-4db4-a18d-c922e3d04de5@googlegroups.com>

This works with GNAT GPL 2017

  type Real_Vector is array (Integer range <>) of Float;
  type Real_Vector_Access is access Real_Vector;

  type foo (M, N: Integer) is record
    y    : Real_Vector (M .. N);
    x_Ptr: Real_Vector_Access := new Real_Vector (M .. N);
  end record;

  F: Foo (-42, 1852);
  x: Real_Vector renames F.x_Ptr.all;

Also this:

  type foo (M, N: Integer) is record
    y    : Real_Vector (M .. N);
    x_Ptr: Real_Vector_Access (M .. N) := new Real_Vector (M .. N);
  end record;

  reply	other threads:[~2017-11-08 13:08 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 [this message]
2017-11-08 17:22 ` Jeffrey R. Carter
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