Boost C++ Libraries: Ticket #9650: intrusive list with stateful value traits https://svn.boost.org/trac10/ticket/9650 <p> In 1.55, in file <code>boost/intrusive/list.hpp</code>, in function <code>list_impl::iterator_to()</code>: when <code>list_impl</code> is instantiated with stateful value traits, the function attempts to call a non-static member without an object. </p> <p> The problem is that <code>list_impl</code> does not derive from <code>value_traits</code>, instead, only its member <code>data_</code> derives from <code>value_traits</code>. Then, inside the non-static <code>iterator_to()</code>, the syntax <code>real_value_traits::to_node_ptr()</code> is incorrect. In contrast, e.g., <code>bstbase3</code> does derive from <code>value_traits</code>, and there the same syntax works just fine. </p> <p> I'm attaching a file demonstrating the bug. The file contains the sample code at the bottom of <a href="http://www.boost.org/doc/libs/1_55_0/doc/html/intrusive/value_traits.html">http://www.boost.org/doc/libs/1_55_0/doc/html/intrusive/value_traits.html</a> with a single line modification invoking <code>iterator_to()</code>. I'll create a pull request. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9650 Trac 1.4.3 Matei David <matei@…> Mon, 10 Feb 2014 20:39:59 GMT attachment set https://svn.boost.org/trac10/ticket/9650 https://svn.boost.org/trac10/ticket/9650 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bug.boost-intrusive-list.cpp</span> </li> </ul> Ticket Matei David <matei@…> Mon, 10 Feb 2014 22:12:47 GMT <link>https://svn.boost.org/trac10/ticket/9650#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9650#comment:1</guid> <description> <p> Pull request here: <a class="ext-link" href="https://github.com/boostorg/intrusive/pull/1"><span class="icon">​</span>https://github.com/boostorg/intrusive/pull/1</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 14 Feb 2014 10:23:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9650#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9650#comment:2</guid> <description> <p> Thanks for the report. The bug is also present in other containers, which shows that stateful value traits are not properly tested. </p> <p> I also think that all "to_value_ptr" and "to_node_ptr" functions should be const as they are used to implement iterators (and operator-&gt; is a const function and must call "to_value_ptr" with a non-const node) and a node&lt;-&gt;conversion should not modify the traits. Do you agree with this? </p> </description> <category>Ticket</category> </item> <item> <author>Matei David <matei@…></author> <pubDate>Sat, 22 Feb 2014 22:13:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9650#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9650#comment:3</guid> <description> <p> Yes, sounds reasonable. Sorry I didn't look at the other containers, I'm only using lists and rbtrees. I'll cancel the pull request because I noticed you have a more thorough fix in 22973145aaa5 </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Thu, 01 May 2014 12:40:20 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9650#comment:4 https://svn.boost.org/trac10/ticket/9650#comment:4 <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> Closed as it was fixed in 22973145aaa5. Thanks. </p> Ticket