Boost C++ Libraries: Ticket #2478: Invalid assert in boost::filesystem::path::iterator https://svn.boost.org/trac10/ticket/2478 <p> The following code asserts (fs = boost::filesystem) </p> <p> <em><strong></strong> Code begin </em></p> <p> fs::path p1("/tmp/unit/repertoire"), p2("/tmp/unit/repertoire/."); </p> <p> fs::path::iterator it1 = p1.begin(), it1e = p1.end(), it2 = p2.begin(), it2e = p2.end(); </p> <p> for(; (*it1 == *it2) &amp;&amp; (it2 != it2e) &amp;&amp; (it1 != it1e); ++it1, ++it2) {} </p> <p> p2 = ""; </p> <p> while(it2 != it2e) { </p> <blockquote> <p> p2 /= *it2; </p> </blockquote> <blockquote> <p> ++it2; <em> &lt;- asserts on this line (first pass) </em></p> </blockquote> <p> } </p> <p> <em><strong></strong> Code end </em></p> <p> The assertion (DEBUG defined) is thrown on line 1342 inside file "boost/filesystem/path.hpp". Basically, the assert checks if the increment it outside of the range of iteration. However, after checking it2 != it2e, I should be able to increment it (but not the dereference it). Moreover, if it2 != it2e, I should be able to call ++it2. </p> <p> The environnement is the following : </p> <ul><li>Windows XP (on virtual box) </li><li>Visual C++ express 2008 (version 9.0.21022.8 RTM) </li><li>Boost 1.37 (I think it is the same with 1.36) </li></ul> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2478 Trac 1.4.3 Raffi Enficiaud <raffi.enficiaud@…> Wed, 05 Nov 2008 15:54:32 GMT <link>https://svn.boost.org/trac10/ticket/2478#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2478#comment:1</guid> <description> <p> Sorry, I didn't notice I was erasing the container p2. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Thu, 06 Nov 2008 16:08:32 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/2478#comment:2 https://svn.boost.org/trac10/ticket/2478#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Beman Dawes</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">filesystem</span> </li> </ul> Ticket Beman Dawes Sun, 11 Jan 2009 23:52:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2478#comment:3 https://svn.boost.org/trac10/ticket/2478#comment:3 <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">invalid</span> </li> </ul> Ticket