Boost C++ Libraries: Ticket #315: Implement operator[] for Tokenizer https://svn.boost.org/trac10/ticket/315 <pre class="wiki">I constantly find myself creating this structure: tokenizer tok(str, sep); vector&lt;string&gt; s; for(tokenizer::iterator iter=tok.begin(); iter!=tok.end(); ++iter) { s.push_back(*iter); } Why not just: tok[0]; to retrieve the first token? (Darel Finkbeiner &lt;darel.finkbeiner@sbcglobal.net&gt;) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/315 Trac 1.4.3 John Maddock Fri, 24 Aug 2007 08:54:47 GMT owner, status, description changed; severity set https://svn.boost.org/trac10/ticket/315#comment:1 https://svn.boost.org/trac10/ticket/315#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">John Maddock</span> to <span class="trac-author">jsiek</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/315?action=diff&amp;version=1">diff</a>) </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket John Maddock Fri, 24 Aug 2007 08:57:20 GMT component changed https://svn.boost.org/trac10/ticket/315#comment:2 https://svn.boost.org/trac10/ticket/315#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">regex</span> → <span class="trac-field-new">tokenizer</span> </li> </ul> Ticket Steven Watanabe Sun, 31 May 2009 13:25:42 GMT <link>https://svn.boost.org/trac10/ticket/315#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/315#comment:3</guid> <description> <p> The correct solution to this is </p> <pre class="wiki">tokenizer tok(str, sep); vector&lt;string&gt; s(tok.begin(), tok.end()); </pre><p> tokenizer cannot support random access efficiently because it is lazy and only has forward iterators. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Tue, 02 Jun 2009 23:37:04 GMT</pubDate> <title>status, resolution changed https://svn.boost.org/trac10/ticket/315#comment:4 https://svn.boost.org/trac10/ticket/315#comment:4 <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-old">None</span> → <span class="trac-field-new">wontfix</span> </li> </ul> Ticket