From: William Kempf (sirwillard_at_[hidden])
Date: 2001-01-03 10:14:50
--- In boost_at_[hidden], "David Abrahams" <abrahams_at_m...> wrote:
> ----- Original Message -----
> From: "Daryle Walker" <darylew_at_m...>
> > I haven't looked at the 'scoped_ptr' stuff, but aren't these
> > overkill? No other object ('tcpipbuf' is noncopyable) or subclass
> > ('tcpip_data_' is private) is supposed to look at the
> > 'tcpipbuf' class could take care of the destruction itself.
> 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. What's
Increased compile time dependencies. You'll have yet another header
to include and another name brought into the namespace indirectly.
You also have problems with visibility of the destructor for the impl
class, as discussed in an early thread on this list.
For the "Pimpl Idiom" I prefer to use code like this:
class impl; // scope it in the class to prevent name clashes
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 and
requires no further compile time dependencies. This just seems to be
the safest approach to this pattern.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk