comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <pchapin@sover.net>
Subject: Re: How to properly clean up an extended, generic structure?
Date: Sun, 09 Jul 2006 12:21:25 -0400
Date: 2006-07-09T12:21:25-04:00	[thread overview]
Message-ID: <44b12d01$0$3650$4d3efbfe@news.sover.net> (raw)
In-Reply-To: <87wtamalvc.fsf@ludovic-brenta.org>

Ludovic Brenta wrote:

> You do not need to change anything to your Splay_Tree; instead, just
> pass a controlled type as the Item_Type.  A controlled type is a type
> derived from Ada.Finalization.Controlled(*).  You override its
> Finalize procedure to reclaim the storage for the item; that's the
> equivalent of a destructor in C++.  The language guarantees (ARM
> 7.6(1)) that the instance of Unchecked_Deallocation will call your
> Finalize, much like delete in C++ will call your destructor.

That sounds good... much better than what I was thinking about before. 
I'll play with it. Thank you (and others) for bringing this to my attention.

Peter



  reply	other threads:[~2006-07-09 16:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-09 13:42 How to properly clean up an extended, generic structure? Peter C. Chapin
2006-07-09 14:29 ` jimmaureenrogers
2006-07-09 14:33 ` Ludovic Brenta
2006-07-09 16:21   ` Peter C. Chapin [this message]
2006-07-09 14:49 ` Björn Persson
2006-07-09 14:57 ` Georg Bauhaus
2006-07-09 19:46 ` Jeffrey R. Carter
2006-07-10  7:38   ` Jean-Pierre Rosen
replies disabled

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