Boost logo

Boost Users :

From: Alan M. Carroll (amc_at_[hidden])
Date: 2008-07-31 15:12:33


At 08:26 AM 7/31/2008, you wrote:
>I would rather put "bool is_shared() const { return m_reference_counter >
>1; }" as protected member, and m_reference_counter as private one. Do you
>need it for something like "intrusive_from_this()" form Boost.Statechart ?

I haven't used Boost.Statechart so I can't speak to that. I do lot of psuedo-value classes, which are PIMPL classes based on intrusive_ptr that do copy on write to act like values instead of handles when it matters (Qt from Trolltech does a lot of that, for a public example). That has an obvious need to test for the reference count being larger than 1.

Rather than is_shared(), you might duplicate the shared_ptr interface, with unique() and use_count(). That'd probably be better for something including in Boost.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net