Boost logo

Boost :

Subject: Re: [boost] cannot pass objects of non-POD type ‘class boost::detail::shared_count’ through ‘...’; call will abort at runtime
From: Stefan Strasser (strasser_at_[hidden])
Date: 2009-09-17 08:19:32


Am Thursday 17 September 2009 14:58:23 schrieb Peter Dimov:
> The signature of sp_enable_shared_from_this has changed, it now takes a
> pointer to a shared_ptr as its first argument. Look at the current
> shared_ptr constructor:
>
> template<class Y>
> explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
> {
> boost::detail::sp_enable_shared_from_this( this, p, p );
> }
>
> Relying on implementation details has its maintenance costs. :-)

I wondered before why shared_count is an implementation detail.
there are obviously use cases besides shared_ptr for this. one of those use
cases is even endorsed by boost, by offering intrusive_ptr.
and the implementation of shared_count has performance advantages over every
portable solution possible, as its implemented compiler- and
platform-specific for many combinations.
so, why's shared_count an implementation detail?


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