Boost logo

Boost :

From: Bill Klein (bill_at_[hidden])
Date: 2001-01-03 10:43:36


>> It depends what you mean by "overkill", I guess. The suggestions eliminate
>> casting, some exception-safety issues, and probably the need to write a
>> destructor in your class. Sounds like simplification to me. What's the
>> downside?

Bill Kempf wrote...
>For the "Pimpl Idiom" I prefer to use code like this:
>
>class my_class
>{
> ...
>private:
> class impl; // scope it in the class to prevent name clashes
> impl* pimpl;
>};
>
>This requires code in my_class to manage the lifetime of the impl
>instance, but this is trivial and impacts only the implementation of
>my_class, while making visibility of the destructor a non-issue...

Err... it forces you to write a non-inline destructor for my_class
to delete pimpl... In what way is this better than having scoped_ptr
force you to write a non-inline destructor which may be empty (if
you don't have anything to do there)?

-Bill Klein <bill_at_[hidden]>


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