Boost C++ Libraries: Ticket #3746: list_iterator::operator == fails to accept a non-const var to the left and a const one to the right https://svn.boost.org/trac10/ticket/3746 <p> The following code fails to compile (msvc 9): </p> <p> using namespace boost::intrusive; struct my_struct : list_base_hook&lt;&gt; {}; typedef list&lt;my_struct&gt; my_list; my_list l; my_list::const_iterator it = l.begin(); if (l.end() == it) {} <em> fails if (it == l.end()) {} </em> succeeds </p> <p> If to use std::list there is no such problem because std::list::iterator is derived from std::list::const_iterator. My suggesion is to use template "operator ==" for list_iterator that accepts both const and non-const interator. For example: </p> <p> ("list_node.hpp") template &lt;bool <a class="missing wiki">IsOtherConst</a>&gt; bool operator== (const list_iterator&lt;Container, <a class="missing wiki">IsOtherConst</a>&gt;&amp; i) const </p> <blockquote> <p> { return members_.nodeptr_ == i.pointed_node(); } </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3746 Trac 1.4.3 Ion Gaztañaga Thu, 26 Aug 2010 10:08:07 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/3746#comment:1 https://svn.boost.org/trac10/ticket/3746#comment:1 <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> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.42.0</span> → <span class="trac-field-new">Boost-1.45.0</span> </li> </ul> <p> Fixed for Boost 1.45 in release branch </p> Ticket