Boost C++ Libraries: Ticket #7829: Add add_ref param to intrusive_ptr::reset https://svn.boost.org/trac10/ticket/7829 <p> intrusive_ptr::reset should have an optional bool add_ref=true parameter just as the intrusive_ptr constructor has. Currently you can call the constructor and assign, but this forces you to mention the template pointer type. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7829 Trac 1.4.3 bruno.uy@… Fri, 28 Dec 2012 15:44:50 GMT <link>https://svn.boost.org/trac10/ticket/7829#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7829#comment:1</guid> <description> <p> Actually I think I prefer </p> <p> template&lt;class T&gt; intrusive_ptr&lt;T&gt; take_ptr(T* t) { </p> <blockquote> <p> return intrusive_ptr&lt;T&gt;(t, false); </p> </blockquote> <p> } </p> <p> from <a class="ext-link" href="http://www.gamedev.net/topic/556405-should-i-be-using-ccomptr--boostshare_ptr-or-boostintrusive_ptr-for-com/#entry4573797"><span class="icon">​</span>http://www.gamedev.net/topic/556405-should-i-be-using-ccomptr--boostshare_ptr-or-boostintrusive_ptr-for-com/#entry4573797</a> </p> <p> 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&lt;T&gt; 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. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Thu, 26 Dec 2013 17:07:34 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7829#comment:2 https://svn.boost.org/trac10/ticket/7829#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Done in <a class="ext-link" href="https://github.com/boostorg/smart_ptr/commit/4de3f36839bfaf800e1f875d2f8e07412f9909bf"><span class="icon">​</span>https://github.com/boostorg/smart_ptr/commit/4de3f36839bfaf800e1f875d2f8e07412f9909bf</a> </p> Ticket