comp.lang.ada
 help / color / mirror / Atom feed
From: d96andgi@dtek.chalmers.se (Anders Gidenstam)
Subject: How to make a generic controlled type?
Date: 1999/09/24
Date: 1999-09-24T16:37:36+00:00	[thread overview]
Message-ID: <7sg9cg$mvm$1@nyheter.chalmers.se> (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 




             reply	other threads:[~1999-09-24  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-24  0:00 Anders Gidenstam [this message]
1999-09-24  0:00 ` How to make a generic controlled type? Ehud Lamm
1999-09-26  0:00   ` David Botton
replies disabled

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