title: sstream vs for loop speed for processing a string
body: <p>I was wondering wether sstream is faster than just a for loop for processing a string?
  say for example we have a string that we can't to separate just the words:</p>
  <pre><code>std::string somestring = &quot;My dear aunt sally went to the market and couldn't find what she was looking for&quot;;
  </code></pre>
  <p>would a string stream be faster? Its definitely prettier.</p>
  <pre><code>std::string temp;
  stringstream input(somestring);
  while(input &gt;&gt; temp){
    std::cout &lt;&lt; temp;
  }
  </code></pre>
  <p>or utilizing a regular old for loop and a buffer?</p>
  <pre><code>std::string buffer; //word buffer
      for(int i= 0; i &lt; somestring.size(); ++i){
          if(somestring.at(i) == 32 &amp;&amp; buffer == &quot;&quot;){
              continue;
          }
          if(somestring.at(i) == 32 || somestring.at(i) == '\n'){
              std::cout &lt;&lt; buffer;
              buffer.clear();
              continue;
          }
          buffer += somestring.at(i);
      }
      std::cout &lt;&lt; buffer;
  </code></pre>
  <p>tldr:
  I guess i'm mainly wondering if sstream is more optimized and faster at processing a string than just a regular for loop?</p>
  <p>EDIT: Edited the forloop</p>