Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-04-19 16:42:36

"Darin Adler" <darin_at_[hidden]> wrote in message
> [...]
> 1) If X is publicly derived from shared_count, it will just work,
> because shared_ptr will find the shared_count part and use it for
> reference counting. There won't be a "detached count".
> 2) If X is not publicly derived from shared_count, then the
> shared_ptr constructor for px3 will fail to compile.

I see...that's very clever. Thanks for spelling it out. I didn't notice
the new shared_count.hpp in CVS until Fernando mentioned it. It
all makes sense now. Technically, you need to derive from
counted_base, but I'm sure that's what you meant. ;) So basically,
shared_ptr will act like intrusive_ptr when necessary.

Would it also make sense to add a shared_ptr(counted_base*)
c'tor for geniuses who try to create a shared_ptr from a refcounted
object directly, instead of from intrusive_ptr? Of course, by this
point, one wonders whether a separate intrusive_ptr is really
needed at all (other than that it's a bit more lightweight).


Boost list run by bdawes at, gregod at, cpdaniel at, john at