title: Compare content of std::stringstream
body: <p>I have two <code>std::stringstream</code>: <code>ss1</code> and <code>ss2</code>, which are given as an argument to two different functions that fills them with data.</p>
  
  <p>I want to sanity check that these functions writes the same content. How do I test for equality of two <code>std::stringstream</code>?</p>
  
  <pre><code>alg1.print(ss1);
  alg2.print(ss2);
  
  if(ss1 != ss2) {
     cout &lt;&lt; "Content not identical!" &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Does not work. Converting them both to <code>str()</code> works, however this seems ineffective. There must be a better way?</p>