comp.lang.ada
 help / color / mirror / Atom feed
* How to make a generic controlled type?
@ 1999-09-24  0:00 Anders Gidenstam
  1999-09-24  0:00 ` Ehud Lamm
  0 siblings, 1 reply; 3+ messages in thread
From: Anders Gidenstam @ 1999-09-24  0:00 UTC (permalink / raw)


Hello!

I'm trying to make a generic list package, and since I implement 
the list as a linked list I want to use a controlled type for it to prevent 
memory leaks. However GNAT (and I assume Ada) doesn't allow me to declare 
a controlled type inside a generic package. So I wonder if someone has a 
nice solution to this problem.   

with Ada.Finalization;

generic
   type Element_Type is private;

package List is

   type List is new Ada.Finalization.Limited_Controlled with private;

   -- Insert E at the current location.
   procedure Insert (L: in out List;
                     E: in     Element_Type);
...


/Anders
--------------------------------------------
"A well-written program is its own heaven; 
 a poorly-written program is its own hell."
  - The Tao of Programming 




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-09-26  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-24  0:00 How to make a generic controlled type? Anders Gidenstam
1999-09-24  0:00 ` Ehud Lamm
1999-09-26  0:00   ` David Botton

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