comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: limited types (Was: Records that could be arrays)
Date: 28 Feb 2006 11:58:11 -0800
Date: 2006-02-28T11:58:11-08:00	[thread overview]
Message-ID: <1141156690.991228.267400@j33g2000cwa.googlegroups.com> (raw)
In-Reply-To: <w24tvc9hkds7.1y1te44mfoup5$.dlg@40tude.net>


Dmitry A. Kazakov wrote:
> On 28 Feb 2006 09:24:35 -0800, Matthew Heaney wrote:
>
> I still don't see CS.

I wrote the declaration wrong; it should have been:

generic
  type ET is private;  --or: type ET (<>) is limited private;
  type CT is private;  --cursor type
  with function E (C : CT) return ET is <>;
procedure Generic_Algorithm (C1, C2 : CT);

The cursor pair [C1, C2) describes a range of elements.  It might be
the entire range of elements in the container, or just a subrange.  The
algorithm doesn't care.


> BTW, if I had CS, would need not to instantiate Generic_Algorithm once
> more.

(I assume "CS" means "container of element type S, and S derives from
type T.")

As far as generic algorithms are concerned, it doesn't matter that type
S derives from type T.  That's what "generic algorithm" means.

And yes, you have to instantiate the algorithm twice, since the cursor
types come from different instantiations of some generic container
package.

Of course, if you instantiate the indefinite container package on
generic actual type T'Class, then you'd only have to instantate generic
algorithm once (assuming generic formal type ET is declared
appropriately, as I show above in the comment).




  reply	other threads:[~2006-02-28 19:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24 16:51 limited types (Was: Records that could be arrays) Thierry Bernier
2006-02-24 21:57 ` Randy Brukardt
2006-02-25  2:21   ` Matthew Heaney
2006-02-25  3:38     ` Matthew Heaney
2006-02-25 11:06   ` Dmitry A. Kazakov
2006-02-25 15:05     ` Matthew Heaney
2006-02-26  1:01       ` Randy Brukardt
2006-02-26  9:00       ` Dmitry A. Kazakov
2006-02-26 18:20         ` Matthew Heaney
2006-02-26 20:52           ` Dmitry A. Kazakov
2006-02-26 22:07             ` Matthew Heaney
2006-02-27  9:11               ` Dmitry A. Kazakov
2006-02-27 14:34                 ` Georg Bauhaus
2006-02-27 16:05                   ` Dmitry A. Kazakov
2006-02-27 16:52                     ` Matthew Heaney
2006-02-27 20:21                       ` Dmitry A. Kazakov
2006-02-27 21:40                         ` Georg Bauhaus
2006-02-28  9:38                           ` Dmitry A. Kazakov
2006-02-27 23:00                         ` Matthew Heaney
2006-02-28  9:39                           ` Dmitry A. Kazakov
2006-02-28 17:24                             ` Matthew Heaney
2006-02-28 19:06                               ` Dmitry A. Kazakov
2006-02-28 19:58                                 ` Matthew Heaney [this message]
2006-02-28 21:03                                   ` Dmitry A. Kazakov
2006-02-28 21:51                                   ` limited types Simon Wright
2006-03-01  1:59                                     ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox