Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7829: Add add_ref param to intrusive_ptr::reset
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-12-28 15:44:50
#7829: Add add_ref param to intrusive_ptr::reset
----------------------------------------------------------+-----------------
Reporter: Bruno Martinez Aguerre <bruno.uy@â¦> | Owner: pdimov
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: smart_ptr
Version: Boost 1.52.0 | Severity: Not Applicable
Resolution: | Keywords: intrusive_ptr
----------------------------------------------------------+-----------------
Comment (by bruno.uy@â¦):
Actually I think I prefer
template<class T>
intrusive_ptr<T> take_ptr(T* t)
{
return intrusive_ptr<T>(t, false);
}
from http://www.gamedev.net/topic/556405-should-i-be-using-ccomptr
--boostshare_ptr-or-boostintrusive_ptr-for-com/#entry4573797
take_ptr is like a hypothetical make_intrusive, which only make sense for
the add_ref=false case because raw T* is already convertible to
intrusive_ptr<T> in the add_ref=true case. take_ptr as a separate function
is also clearer than a false argument to the constructor, and with
r-values, as efficient as reset(ptr, false) would be. If I could travel
back in time I would suggest take_ptr as a friend function and getting rid
of the add_ref parameter altogether.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7829#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC