comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: Deallocating list of polymorphic objects?
Date: Fri, 01 Dec 2006 03:52:44 GMT
Date: 2006-12-01T03:52:44+00:00	[thread overview]
Message-ID: <uy7psclx5.fsf@earthlink.net> (raw)
In-Reply-To: 1164930027.758923.119740@h54g2000cwb.googlegroups.com

"Michael Rohan" <mrohan@ACM.ORG> writes:

> I would like to construct a list of polymorphic objects that,
> as part of the list's finalization, deallocates the objects on
> the list.  Basically, I have a vector of pointers to Object'Class.

The easiest way to do that is using the indefinite form:

with Ada.Containers.Indefinite_Vectors;

package Object_Vectors is
  new Ada.Containers.Indefinite_Vectors (Object'Class);

As others have pointed out, the Ada run-time properly handles deallocation of
objects having a class-wide type, so there's nothing special you need to do.



  parent reply	other threads:[~2006-12-01  3:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30 23:40 Deallocating list of polymorphic objects? Michael Rohan
2006-12-01  0:05 ` Robert A Duff
2006-12-01  6:41   ` Simon Wright
2006-12-01  1:24 ` Randy Brukardt
2006-12-01  8:57   ` Maciej Sobczak
2006-12-01 12:33     ` Matthew Heaney
2006-12-01 13:05       ` Maciej Sobczak
2006-12-01 14:56         ` Matthew Heaney
2006-12-01 19:03           ` Georg Bauhaus
2006-12-01  3:52 ` Matthew Heaney [this message]
2006-12-01  4:11 ` Matthew Heaney
2006-12-01  6:12   ` Michael Rohan
2006-12-01 12:40     ` Matthew Heaney
replies disabled

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