Boost C++ Libraries: Ticket #3941: match_results relies on string evaluated by regex_search() https://svn.boost.org/trac10/ticket/3941 <p> See example: If "text" is altered or destroyed, "matches" becomes invalid. Is this the desired behavior? </p> <hr /> <blockquote> <p> string pattern="<sup><br />s*:(<br />S+)<br />s*"; string text=" :command "; </sup></p> </blockquote> <blockquote> <p> boost::regex re(pattern); </p> </blockquote> <p> </p> <blockquote> <p> boost::match_results&lt;string::const_iterator&gt; matches; bool stat=boost::regex_search(text, matches, re); text=""; <em>Truncate string cout&lt;&lt;matches<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a>.str()&lt;&lt;endl; </em>&lt;&lt;Throws sting iterator not dereferencable exception </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3941 Trac 1.4.3 John Maddock Thu, 18 Feb 2010 09:13:09 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3941#comment:1 https://svn.boost.org/trac10/ticket/3941#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">invalid</span> </li> </ul> <p> This is by design: match_results store <em>iterators</em>, not strings. </p> Ticket