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).


|