Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-07 13:26:05


From: "Gennadiy Rozental" <rogeeff_at_[hidden]>
> > Why wouldn't you use your own framework to make a COM smart pointer for
> > this? Consider what happens when you forget to specialize the traits
class
> > for some COM interface.
>
> I can always typedefdef whatever you want. For example:
>
> template<typename T>
> typedef smart_ptr<T, ownership_is<intrusive_ref_counted> > IntrusivePtr;
>
> Now following will never compile:
> class A;
> IntrusivePtr<A> v;
>
> If you forgot to specialize itrusive_... traits you will get just plain
> pointer, the same if you would use just T*.

No, you'd get the default behavior of shared_ptr, a detached count.

> But what you expect?! This is a
> price for using of unified interface. Do you know other solution to make
> COM-based intrusive counted pointer to work with unified interface like
> shared_ptr?

Why would you want to do that? The whole point of the unified shared_ptr
interface is that different instances of shared_ptr<A> can use different
deallocators in the same program. If you need a COM smart pointer, why not
simply use one?


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