Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-07-17 09:59:31


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, July 17, 2002 11:14 AM
Subject: Re: [boost] Logical constness of intrusive_ptr

> From: "Ed Brey" <brey_at_[hidden]>
> > Currently intrusive_ptr<T const> is not supported, ultimately because
> counted_base::use_count_ is not mutable. To me it seems like the count of
> references to an object are unrelated to its logical constness. What do
> others think?
> <
>
> Nontrivial question. I don't have enough experience with it yet in order
to
> decide.
>
FWIW, my own intrusive pointer uses a mutable count. It's been working fine
for nearly half a decade now, so I would say that having a mutable count is
OK AFAICT.

> In the general case, intrusive_ptr<> doesn't really know whether the count
> is part of the object state. It all depends on how intrusive_ptr_add_ref
> (release) is defined for the specific type; if it takes const pointers,
> intrusive_ptr<T const> should work fine.
>
I think it should take const pointers.

> In the specific case of objects derived from counted_base, either choice
> seems plausible, since there's the option of using shared_ptr<T const> to
> denote const objects.
>
I think counted_base::add_ref(),release(),dispose(),etc.. should all be
const.

P.S: I noticed while inspecting the latest boost code that
'intrusive_ptr.hpp' doesn't include 'detail\shared_count.hpp'.
Should it? I might want to use only intrusive_ptr<>, not shared_ptr<>.

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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