Boost logo

Boost Users :

Subject: [Boost-users] Incomplete types and intrusive_ptr
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2009-05-12 15:55:50


Is it possible to achieve the ability of shared_ptr<T> to be used as a
class member in a class declaration with an incomplete type T, with
intrusive_ptr?

For new code, I'm wrapping classes in shared_ptr, instead of deriving
from our refcounted base class. I've also started to use intrusive_ptr
for all the legacy code that already derives from RefCountedBase, but
unlike shared_ptr I'm forced to #include the header for the type
wrapped in the intrusive_ptr, something I'd like to avoid, to reduce
build times.

Isn't it possible to have a mix of shared_ptr and intrusive_ptr which
also captures a Destructor instance when the intrusive_ptr is
assigned, similarly to what shared_ptr does? Has this been considered
before?

Thanks, --DD

PS: We have full control of RefCountedBase, so would refactoring it to
use boost::detail::shared_count internally allow the change I discuss
above? If so, how would one go about it?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net