|
Boost Users : |
From: Jean-François Brouillet (verec_at_[hidden])
Date: 2005-05-17 15:42:35
>>> 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?
>
> http://boost.org/libs/smart_ptr/intrusive_ptr.html#constructors
The above link only has this to say:
> constructors
>
> intrusive_ptr(); // never throws
> Postconditions: get() == 0.
>
> Throws: nothing.
>
> intrusive_ptr(T * p, bool add_ref = true);
> Effects: if(p != 0 && add_ref) intrusive_ptr_add_ref(p);.
>
> Postconditions: get() == p.
>
> intrusive_ptr(intrusive_ptr const & r); // never throws
> template<class Y> intrusive_ptr(intrusive_ptr<Y> const & r); //
> never throws
> Effects: if(r.get() != 0) intrusive_ptr_add_ref(r.get());.
>
> Postconditions: get() == r.get().
Hardly a reference to "factory" or that "someone else" has already
taken ownership ...
> add_ref == false means that you (or someone else) already called
> addr ef on the pointer. It's typically used with factory functions
> that return addref'ed pointers.
That settles it then.
I just cannot use intrusive_ptr. Since shared_ptr is already
ruled out, well .... roll-my-own-time, I guess ...
Too bad for my use of boost.
Many thanks.
-- JFB
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