Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-05-06 13:53:38


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:005001c1f4f2$5c989110$1d00a8c0_at_pdimov2...
> > a. Storage policy should answer the question: "HOW to store, access,
> copy
> > and release the resource".
> > b. Ownership policy should answer the question: "WHEN to release the
> > resource".
>
> This is a good separation, but how do you apply it to COM-style intrusive
> counted, self-deleting objects?

There is no contradiction here. Look into proposed Ownership/Storage
policies interface. I did not say that they could not share information
storage (like with intrusive reference counting), what I meant is logic
separation.

>
> > I do support intrusive reference counting through traits. I believe it
> more
> > flexible.
>
> In what ways is it more flexible?
>

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. I admit that following lines in some
file a.cpp could vialate ODR:

class A; // A type that has intrusive reference counter
smart_ptr<A> v;

But thince you can't really do anything with this variable without include
A.hpp, I still think it's not that huge problem, though I open for
discussion.
   Anyway I going to provide support for boost::shared_ptr logic also.

Gennadiy.


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