From: Dmitriy Anisimkov <vagul@chat.ru>
Subject: Re: Generics and I/O
Date: 1998/10/03
Date: 1998-10-03T00:00:00+00:00 [thread overview]
Message-ID: <36159D3E.EEADFF66@chat.ru> (raw)
In-Reply-To: Pine.GSO.3.96L.981002182724.301A-100000@unixs1.cis.pitt.edu
if you Item is a scalar type then :
with Text_IO;
> generic
> type Item is private;
> package Foo is
> -- ... --
procedure Print(Value : Item) is
> -- ... --
Text_IO.Put( Value'Image );
> -- ... --
> end Print;
> end Foo;
if you Item is only integer type then :
with Ada.Text_IO.Integer_IO;
> generic
type Item is range <>; -- must be
> package Foo is
> -- ... --
package Item_IO is new Ada.Text_IO.Integer_IO(Item); -- instantiation
use Item_IO;
procedure Print(Value : Item) is -- must be
> -- ... --
Put( Value ); -- must be
> -- ... --
> end Print;
> end Foo;
next prev parent reply other threads:[~1998-10-03 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-02 0:00 Generics and I/O William L Hayhurst
1998-10-03 0:00 ` Dmitriy Anisimkov [this message]
1998-10-03 0:00 ` Niklas Holsti
1998-10-06 0:00 ` Robert I. Eachus
1998-10-07 0:00 ` Dale Stanbrough
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox