Boost logo

Boost :

From: DKl_at_[hidden]
Date: 2002-04-19 08:33:14


brangdon_at_[hidden] wrote:
> I hope we don't lose the ability to write:

> class Impl;
> smart_ptr<Impl> pImpl;

> In other words, smart pointers to incomplete types. We may not know
> what Impl's base class is.

This is an interesting aspect: If you had the appropriate configuration
for 'Impl' available (which in this case is obviously the default
configuration), it would be fine. Since the base class is unknown, it
is insufficient to rely on the base class. However, something like

      class Impl;
      template <>
      struct smart_ptr_cfg<Base>: smart_ptr_cfg<Impl> {};
      smart_ptr<Impl> pImpl;

could probably provide the necessary configuration: If the implicit
knowledge is unavailable it has to be provided explicitly.

Also note, that I don't have any system for this stuff ready or
something like this. I just want to point out that a policy-based smart
pointer is not a solution to all smart pointer related problems. Neither
are the current smart pointers: There is definitely something needed in
this area which is, as far as I can see, not yet addressed.

BTW: Since thie pImpl is not supposed to leak to the outside anyway,
  a specific type including a specifically configured policy-based
  smart pointer can be used. On the other hand, sometimes it makes sense
  to use opaque types as handles...

--
<mailto:dietmar_kuehl_at_[hidden]> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>

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