comp.lang.ada
 help / color / mirror / Atom feed
From: Marius Amado-Alves <marius@amado-alves.info>
To: comp.lang.ada@ada-france.org
Subject: Re: Actual stream of a certain type
Date: Thu, 27 Jul 2006 09:45:45 +0100
Date: 2006-07-27T10:50:50+02:00	[thread overview]
Message-ID: <mailman.4.1153989964.32700.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <kqdop3ewo06.z30ns7l2w4h5.dlg@40tude.net>

>    procedure Write_T (Stream : in out T_Stream; Item : T'Class) is
>    begin
>       Foobar (Stream, Item);
>    end Write_T;
>
>    procedure Write
>              (  Stream : access Ada.Streams.Root_Stream_Type'Class;
>                 Item   : T
>              )  is
>    begin
>       if Stream.all not in T_Stream'Class then
>          raise Actual_Stream_Must_Be_A_T_Stream;
>       else
>          Write_T (T_Stream'Class (Stream.all), Item);
>       end if;
>    end Write;

Thanks a lot! I'll try this. I did not try it before because I  
thought the call to Write_T on Write would not pass Stream as a  
variable, i.e. the conversion would create a read-only view. But if  
you wrote it, it must be one of those Ada idiosyncrasies. Thanks a lot.




  reply	other threads:[~2006-07-27  8:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-26 17:27 Actual stream of a certain type Marius Amado-Alves
2006-07-26 18:25 ` tmoran
2006-07-26 23:47   ` Marius Amado-Alves
2006-07-27  8:05     ` Dmitry A. Kazakov
2006-07-27  8:45       ` Marius Amado-Alves [this message]
     [not found]       ` <2AA0FC04-5130-42BF-A6C9-03C3D6F4C642@amado-alves.info>
2006-07-27 10:47         ` Marius Amado-Alves
     [not found]   ` <71E9A504-B016-49E2-AB85-34CCDF0AEEC8@amado-alves.info>
2006-07-27  0:25     ` Marius Amado-Alves
     [not found] <03AF72A2-6759-4DE5-9D52-4E8266C19C43@amado-alves.info>
2006-07-26 18:04 ` 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