Boost C++ Libraries: Ticket #3438: node algorithms not usable with custom pointer types https://svn.boost.org/trac10/ticket/3438 <p> throughout the node algorithms, especially the tree algorithms, node_ptr's are constructed using node_ptr(0). not all pointer types are constructible from 0. the default constructor, node_ptr(), should be used. a patch is attached. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3438 Trac 1.4.3 anonymous Sat, 12 Sep 2009 05:13:54 GMT attachment set https://svn.boost.org/trac10/ticket/3438 https://svn.boost.org/trac10/ticket/3438 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">intrusive.patch</span> </li> </ul> <p> patch. replaces every instance of node_ptr(0) with node_ptr() </p> Ticket anonymous Sat, 12 Sep 2009 05:17:06 GMT <link>https://svn.boost.org/trac10/ticket/3438#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3438#comment:1</guid> <description> <p> my patch somehow wasn't created recursively, so files in intrusive/detail/* aren't included. please change those files manually. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Sat, 12 Sep 2009 08:38:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3438#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3438#comment:2</guid> <description> <p> Why shouldn't be constructible from 0? A smart pointer that wants to be like a raw pointer should support 0 initialization. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 12 Sep 2009 17:07:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3438#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3438#comment:3</guid> <description> <p> why should it be constructible from 0? I know that the intrusive containers are only supposed to support certain types of pointers as their <a class="missing wiki">VoidPointer</a>, but the algorithms don't have that restriction. not all pointer types want to be like raw pointers and are constructible from raw pointers. in fact, shared_ptr is not constructible from 0. (just an example, I'm not trying to use shared_ptrs). it does accept raw pointers, but not 0, as a template&lt;class Y&gt; shared_ptr(Y *) is not instantiated for 0. </p> <p> and the node algorithms can go far beyond using pointers. e.g. you could use file offsets as pointer types, with 0 being a valid offset, to build a tree that resides in a file. and it's a very easy fix with no downsides. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 12 Sep 2009 22:47:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3438#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3438#comment:4</guid> <description> <p> unfortunately, there are more (and bigger) problems like that: e.g. tree_algorithms.hpp:143: </p> <blockquote> <p> static node_ptr uncast(const_node_ptr ptr) { </p> <blockquote> <p> return node_ptr(const_cast&lt;node*&gt;(::boost::intrusive::detail::get_pointer(ptr))); </p> </blockquote> <p> } </p> </blockquote> <p> why do you even have to typedef node_ptr in the node traits, when it's later assumed that node_ptr is castable to (node *)? I've seen that you offer the possibility of an ADL overload, but unfortunately that's still a dealbreaker. I can't convert my pointer type to a raw pointer. </p> <p> can you explain to me what's the rational behind accepting const_node_ptr's in the tree_algorithms interface and then const-casting it all the time? </p> <p> circular_list_algorithms doesn't have these problems, my linked list using the same pointer type works just fine. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Thu, 26 Aug 2010 11:24:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3438#comment:5 https://svn.boost.org/trac10/ticket/3438#comment:5 <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">wontfix</span> </li> </ul> <p> This feature request won't be supported since it requires massive reworking. </p> Ticket