From: Rainer Deyke (root_at_[hidden])
Date: 2001-04-04 08:14:22
----- Original Message -----
From: "Shankar Sai" <sai.shankar_at_[hidden]>
Sent: Tuesday, April 03, 2001 9:31 PM
Subject: RE: [boost] Re: scoped_ptr: trivial dtor?
> |> >
> |> > That is the idiom I was talking about.
> |> Then there shouldn't be a problem. Declaring '~C' in 'C'
> |> and placing the
> |> definition for 'C::~C' below the definition for 'Cimpl'
> |> causes 'Cimpl' to be
> |> a complete type at the point where
> |> 'scoped_ptr<Cimpl>::~scoped_ptr' is
> |> called. 'Cimpl' doesn't even need a trivial destructor.
> What if ~C (and/or ~CImpl) is trivial because of scoped_ptr and I don't
> declare/define it currently? In this case, where would ~C (and
> consequently ~Cimpl) be instantiated?
In this context a destructor is "trivial" if it does not need to be called.
'~C' is therefore never trivial because '~scoped_ptr' needs to be called.
By not declaring '~C', you are revealing to your client code that '~CImpl'
is trivial, therefore defeating the purpose of the idiom.
-- Rainer Deyke (root_at_[hidden]) Shareware computer games - http://rainerdeyke.com "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk