Boost logo

Boost :

From: Arun Sivaramakrishnan (aruns_at_[hidden])
Date: 2001-04-04 10:39:19


On Wednesday, April 04, 2001 12:43 AM Rainer Deyke wrote
>
> > At 10:20 AM 4/3/2001, Rainer Deyke wrote:
> > >// C.hpp
> > >class Cimpl;
> > >class C {
> > >public:
> > > ~C();
> > >private:
> > > boost::scoped_ptr<Cimpl> impl;
> > >};
> > >
> > >// C.cpp
> > >class Cimpl {
> > >};
> > >
> > >C::~C()
> > >{
> > >}
> > >
> > >Am I missing something, or are you talking about a different idiom?
> >
> > 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.

    To compile C.cpp ,yes we dont need CImpl to be trivial ,but in other
translation units
where the C.h is included and C -objects might be used ,CImpl and its
destructor would'nt be visible then,would it? So to use the idiom we do need
CImpl to be trivial ,dont we?.I guess this puts me back to where we started.
Somebody please clarify!

Also,
On Tuesday, April 03, 2001 4:29 AM Beman wrote:
>> >>
>> ~scoped_ptr() {
>> sizeof(T);
>> delete p;
>> }
>If you did that, scoped_ptr could not be used with incomplete
>types. Although you have to be careful that the destructor is trivial, it
>is highly desirable to be able to use scoped_ptr with incomplete types. I
>must be missing your point.

Later ,

On Wednesday, April 04, 2001 3:24 AM Beman wrote:
>>Ah! The light dawns on Marblehead! I had been misreading C::~C as
>>Cimpl::~Cimpl.

Mine is still dark.Beman, did u change your opinion? Why?

-arun.


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