From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: subtype definitions
Date: Wed, 26 Sep 2012 16:58:03 +0300
Date: 2012-09-26T16:58:03+03:00 [thread overview]
Message-ID: <acgfvbFj8btU1@mid.individual.net> (raw)
In-Reply-To: <dee2be1d-30fc-4a0a-bc6e-424419a530be@googlegroups.com>
On 12-09-26 16:45 , bj�rn lundin wrote:
> Hi!
>
> I got a type definition as
>
> type Assignment_Type_Type is (Transport, Store, Retrieve, Rearrange, Check,
> Set_Error, Restore, Mob_Trsp1, Mob_Trsp2,
> Mob_Trsp3, Mob_Trsp4, Mob_Store, Mob_Check);
>
> I want to loop through some of the values, in another order
>
> for Asm_Type in Transport | Check | Restore | Set_Error | Store loop
> Do_Something(Asm_Type);
> end loop;
>
> The above does not compile.
>
> subtype Asm_Type_Type is Assignment_Type_Type range Transport | Check | Restore | Set_Error | Store ;
> no go .
>
> Is there a valid construction in Ada 05 (gnat) that I can use?
This is what comes to mind, apart from a simple sequence of calls to
Do_Something:
Loop_Order : constant array (Integer range <>)
of Assignment_Type_Type :=
(Transport, Check, Restore, Set_Error, Store);
for L in Loop_Order'Range loop
Do_Something (Loop_Order(L));
end loop;
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2012-09-26 13:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 13:45 subtype definitions björn lundin
2012-09-26 13:58 ` Niklas Holsti [this message]
2012-09-26 14:36 ` björn lundin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox