Boost C++ Libraries: Ticket #6346: boost::regex::begin() and boost::regex::end() always return 0 https://svn.boost.org/trac10/ticket/6346 <p> Hi, </p> <p> <strong>boost::basic_regex&lt;...&gt;::begin()</strong> and <strong>boost::basic_regex&lt;...&gt;::end()</strong> always return <strong>0</strong> (zero). This is because of the status test in the relevant functions in <strong>boost::re_detail::basic_regex_implementation&lt;...&gt;</strong> (in the file boost/regex/v4/basic_regex.hpp: The test is </p> <pre class="wiki">!this-&gt;m_status ? ... </pre><p> it should be </p> <pre class="wiki">this-&gt;m_status ? ... </pre><p> (without the '!'). The status is good if equal to zero, <strong>!...</strong> is good if NOT equal to zero. Note that the <strong>str()</strong> function a few lines above have a less confusing test: </p> <pre class="wiki">if(this-&gt;m_status == 0) </pre><p> The fix is trivial: remove the '!' (or use the same test as in str()), but I tested it very quickly. </p> <p> I join a small source code showing the bug, the output of this program (with bug not fixed and fixed), and a patch. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6346 Trac 1.4.3 nowahn <nowahn@…> Mon, 02 Jan 2012 18:51:50 GMT attachment set https://svn.boost.org/trac10/ticket/6346 https://svn.boost.org/trac10/ticket/6346 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">watchbeginendbug.cpp</span> </li> </ul> <p> Source code showing the bug. </p> Ticket nowahn <nowahn@…> Mon, 02 Jan 2012 18:52:21 GMT attachment set https://svn.boost.org/trac10/ticket/6346 https://svn.boost.org/trac10/ticket/6346 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">output</span> </li> </ul> <p> Output of the test program. </p> Ticket nowahn <nowahn@…> Mon, 02 Jan 2012 18:52:57 GMT attachment set https://svn.boost.org/trac10/ticket/6346 https://svn.boost.org/trac10/ticket/6346 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">fixbeginend.patch</span> </li> </ul> <p> Patch fixing the bug. </p> Ticket John Maddock Sat, 07 Jul 2012 18:36:26 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6346#comment:1 https://svn.boost.org/trac10/ticket/6346#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> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/79340" title="Fix begin() and end() members and add tests. Fixes #6346.">[79340]</a>) Fix begin() and end() members and add tests. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6346" title="#6346: Bugs: boost::regex::begin() and boost::regex::end() always return 0 (closed: fixed)">#6346</a>. </p> Ticket John Maddock Mon, 16 Jul 2012 08:38:29 GMT <link>https://svn.boost.org/trac10/ticket/6346#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6346#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/79556" title="Merge collected bug fixes from Trunk: Refs #589. Refs #7032. Refs ...">[79556]</a>) Merge collected bug fixes from Trunk: Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/589" title="#589: Bugs: regex_replace bug (closed: fixed)">#589</a>. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7032" title="#7032: Bugs: Prevent tool Bug Fix. (closed: fixed)">#7032</a>. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7084" title="#7084: Bugs: memory leak in fileiter.cpp (closed: fixed)">#7084</a>. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6346" title="#6346: Bugs: boost::regex::begin() and boost::regex::end() always return 0 (closed: fixed)">#6346</a>. </p> </description> <category>Ticket</category> </item> </channel> </rss>