Boost C++ Libraries: Ticket #4858: Documentation error - Responsefile example code can crash https://svn.boost.org/trac10/ticket/4858 <p> Hello,<br /> in the example concerning Response Files the following code has an error:<br /> </p> <pre class="wiki"> tokenizer&lt;char_separator&lt;char&gt; &gt; tok(ss.str(), sep); vector&lt;string&gt; args; copy(tok.begin(), tok.end(), back_inserter(args)); </pre><p> ss.str() in line 1 is a temporary. tokenizer will not store a copy, just iterators, so when tok is used in line 3 it refers to an invalid string.<br /> <br /> Code should be changed to:<br /> </p> <pre class="wiki"> std::string ResponsefileContents( ss.str() ); tokenizer&lt;char_separator&lt;char&gt; &gt; tok(ResponsefileContents, sep); vector&lt;string&gt; args; copy(tok.begin(), tok.end(), back_inserter(args)); </pre><p> Best regards<br /> Sönke </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4858 Trac 1.4.3 Marshall Clow Sun, 05 Dec 2010 20:17:10 GMT <link>https://svn.boost.org/trac10/ticket/4858#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4858#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/67030" title="Doc fix; refs #4858">[67030]</a>) Doc fix; refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4858" title="#4858: Bugs: Documentation error - Responsefile example code can crash (closed: fixed)">#4858</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Sun, 05 Dec 2010 20:37:02 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4858#comment:2 https://svn.boost.org/trac10/ticket/4858#comment:2 <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/67034" title="Merge doc patches to release; fixes #3992, fixes #4858">[67034]</a>) Merge doc patches to release; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3992" title="#3992: Bugs: Example in documentation for program_options doesn't compile (closed: fixed)">#3992</a>, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4858" title="#4858: Bugs: Documentation error - Responsefile example code can crash (closed: fixed)">#4858</a> </p> Ticket