Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-09-01 20:48:40


Kim Barrett wrote:
> In boost-1.33.1 and before, and still in boost-cvs, the base
> polymorphic archive classes (polymorphic_iarchive,
> polymorphic_oarchive) have non-virtual (default) destructors. The
> typical usage pattern for these types is to construct a derived class
> and return the base pointer to clients, who only know that the
> archive is a polymorphic archive, and not the specific derived class.
> This results in the client not being able to correctly delete the
> archive, even though the destructor is accessible (and so, easily
> invoked). I think that the right solution here is for the base
> polymorphic archive classes to define a public virtual destructor.

I doubt its a problem in practice as the derived archive is usually
constructed on the stack and thus gets
destroyed automatically when it goes out of scope.

Never the less, it looks to me like you're correct so I'll make the
change in the CVS Head

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk