From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a7e924605448fc4e,start X-Google-Attributes: gid103376,public From: d96andgi@dtek.chalmers.se (Anders Gidenstam) Subject: How to make a generic controlled type? Date: 1999/09/24 Message-ID: <7sg9cg$mvm$1@nyheter.chalmers.se>#1/1 X-Deja-AN: 529112083 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@chalmers.se X-Trace: nyheter.chalmers.se 938191056 23542 129.16.30.75 (24 Sep 1999 16:37:36 GMT) Organization: Chalmers University of Technology Mime-Version: 1.0 NNTP-Posting-Date: 24 Sep 1999 16:37:36 GMT Newsgroups: comp.lang.ada Date: 1999-09-24T16:37:36+00:00 List-Id: 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