From: William Kempf (sirwillard_at_[hidden])
Date: 2001-01-03 11:26:23
--- In boost_at_[hidden], Bill Klein <bill_at_o...> wrote:
> >> It depends what you mean by "overkill", I guess. The suggestions
> >> casting, some exception-safety issues, and probably the need to
> >> destructor in your class. Sounds like simplification to me.
> >> downside?
> Bill Kempf wrote...
> >For the "Pimpl Idiom" I prefer to use code like this:
> >class my_class
> > ...
> > 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
> >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)?
It's not better, just more obvious. Many coders (as evidenced by
these threads) are confused about how to make scoped_ptr<> work in
cases like this. It's not obvious that a non-inlined destructor is
The big draw back is in the compile time dependencies, though.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk