Boost C++ Libraries: Ticket #2774: boost::tokenize fails on Ubuntu8.10 64bit https://svn.boost.org/trac10/ticket/2774 <p> The code in the attached file fails to report the proper tokens on Ubuntu8.10 64bit, while it works fine in the 32bit edition: </p> <p> The output on 64bit is: </p> <p> $ ./token hallo:du:da Token: 'hallo' Token: 'o' Token: 'da' </p> <p> On 32bit it is as expected: </p> <p> $ ./token hallo:du:da Token: 'hallo' Token: 'du' Token: 'da' </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2774 Trac 1.4.3 grumbel@… Tue, 17 Feb 2009 23:02:25 GMT attachment set https://svn.boost.org/trac10/ticket/2774 https://svn.boost.org/trac10/ticket/2774 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">token.cpp</span> </li> </ul> <p> Tokenizer Example </p> Ticket Steven Watanabe Wed, 18 Feb 2009 01:26:47 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2774#comment:1 https://svn.boost.org/trac10/ticket/2774#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> tokenizer does not store a copy of the string, it stores a pair of iterators. The temporary string that you are passing to the constructor is immediately destroyed, invalidating the iterators. </p> <p> This works: </p> <pre class="wiki"> std::string arg(argv[1]); tokenizer tokens(arg, sep); </pre> Ticket william.l.blevins@… Thu, 07 Jun 2012 18:40:58 GMT <link>https://svn.boost.org/trac10/ticket/2774#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2774#comment:2</guid> <description> <p> How is this ticket invalid? </p> <p> BoostTokenizer provides a constructor that allows for: </p> <ol><li>memory corruption </li><li>tokens are arbitrarily parsed incorrectly </li></ol><pre class="wiki">// This should be valid tokenizer tokens(std::string(argv[1]), sep); </pre><p> There should at least be documentation for a precondition {@precondition} where this case is listed explicitly. </p> </description> <category>Ticket</category> </item> </channel> </rss>