From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Discriminant of a limited type object
Date: Wed, 28 Feb 2018 07:36:49 +0100
Date: 2018-02-28T07:36:49+01:00 [thread overview]
Message-ID: <p75ilv$rqm$1@gioia.aioe.org> (raw)
In-Reply-To: p74nge$1oto$1@gioia.aioe.org
Le 27/02/2018 à 23:53, Dmitry A. Kazakov a écrit :
> A : T (1..N);
> begin
> for Index in A'Range loop
> do-init of A (Index)
> end loop;
>
> |
> V
>
> Index : Positive := 1;
> function F return Element is
> begin
> Index := Index + 1;
> return do-init of A (Index - 1);
> end F;
> A : T (1..N) := (others => F)
But this does not guarantee the order of components. I'd rather write
(changing do_init to a function):
function Init_All (Size : Integer) return T is
begin
if Size = 1 then
return (1 => do_init)
else
return do_init & Init_All (size - 1);
end if;
end;
A : T := Init_All (N);
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
next prev parent reply other threads:[~2018-02-28 6:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 17:54 Discriminant of a limited type object Dmitry A. Kazakov
2018-02-27 22:20 ` Randy Brukardt
2018-02-27 22:53 ` Dmitry A. Kazakov
2018-02-28 6:36 ` J-P. Rosen [this message]
2018-02-28 8:42 ` Dmitry A. Kazakov
2018-02-28 9:07 ` J-P. Rosen
2018-02-28 17:16 ` Jeffrey R. Carter
2018-02-28 23:10 ` Randy Brukardt
2018-03-01 8:43 ` Dmitry A. Kazakov
2018-03-01 22:00 ` Randy Brukardt
2018-03-02 10:30 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox