From: Marius Amado Alves <amado.alves@netcabo.pt>
To: comp.lang.ada@ada-france.org
Subject: Re: Problem with generic parameter
Date: Wed, 22 Jun 2005 15:26:20 +0100
Date: 2005-06-22T15:26:20+01:00 [thread overview]
Message-ID: <mailman.84.1119450437.17633.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <m21x6u7d3m.fsf@hugin.crs4.it>
>> generic
>> type Indices is (<>);
>> package Generic_Root
>> type Measurement is array (Indices) of Measurement;
>
> The reason that I don't do that is that that would have to instantiate
> a copy of Generic_Root _and_ Generic_Root.Child for each choice of
> array indices.
No you don't. (The above example was misleading.)
generic
type Indices is (<>);
package Generic_Root.Child_By_Marius is
type Measurement_Array is
array (Indices range <>) of Measurement;
end;
with Generic_Root;
with Generic_Root.Child_By_Marius;
procedure Marius_Demo is
type Scalar is digits 15;
package Measurements is
new Generic_Root (Scalar => Scalar);
package Measurements_Text_IO is
new Measurements.Child_By_Marius
(Indices => Positive);
use Measurements_Text_IO; --|
Array_1 : Measurement_Array (1 .. 10); --| *HERE*
Array_2 : Measurement_Array (2 .. 20); --|
begin
null;
end;
next prev parent reply other threads:[~2005-06-22 14:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 10:21 Problem with generic parameter Jacob Sparre Andersen
2005-06-22 11:16 ` Martin Dowie
2005-06-22 11:58 ` Marius Amado Alves
2005-06-22 13:09 ` Jacob Sparre Andersen
2005-06-22 14:26 ` Marius Amado Alves [this message]
[not found] ` <f6af3631a69872fe2f46258f86b08473@netcabo.pt>
2005-06-22 12:43 ` Marius Amado Alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox