Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-05-07 12:53:19


"Peter Dimov" <pdimov_at_[hidden]> wrote in message news:009901c1f5c2$7d9b6100
> > As far as I understand boost::shared_ptr support for intrusive ref.
> counting
> > rely on the fact that user type inherit counted_base. I may be
convinient,
> > but for one: it not generic enough to cover all the cases (COM-style is
> one
> > example), and for two: in some cases I can't afford usind dynamic
> binding,
> > so I would prefer compile time one.
>
> 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*. 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?

Gennadiy.


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