Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-05-16 19:01:19

Jean-François Brouillet wrote:
> As observed in another thread, the intrusive_ptr destructor
> in boost 1.32 does not honor its own status as defined in
> the constructor with respect to the addRef boolean.
> This snippet shows the problem:
> X * x = new X ;
> {
> intrusive_ptr<X> p(x, false) ;
> }
> // Here, x has been destroyed!
> Is this a bug, or some requirement (that I couldn't find) that
> if you ever pass "false" to the constructor, then that intrusive_ptr
> is assumed to never go out of scope?

add_ref == false means that you (or someone else) already called addref on
the pointer. It's typically used with factory functions that return
addref'ed pointers.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at