Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-04-25 09:45:32

On Apr 25, 2004, at 7:00 AM, John Maddock wrote:

> Maybe, but lets not forget that shared_ptr doesn't need a mutex at
> all, what
> it needs is an atomic counter (actually less than that, because we
> never
> need the value of the counter just whether it's less than/greater
> than, or
> equal to zero).

shared_ptr has two counts which sometimes must both be incremented in
an atomic fashion.

> template <class T, bool threaded = BOOST_SP_DEFAULT>
> class shared_ptr;
> Which I think I'm right in saying would be std conforming (because
> we're
> permitted additional defaulted template parameters right?), and would
> also
> quash any potential ODR violations.

Actually no, it would not be standard conforming for a hypothetical
std::shared_ptr, unless the standard granted specific permission for
this one template. (or specified the defaulted template in the first


Boost list run by bdawes at, gregod at, cpdaniel at, john at