title: C++ Int to String by using ostringstream or stringstream
body: <p>I've been using <code>stringstream</code> to convert <code>Integer</code> to <code>String</code>, but then I realized same operation can be done with <code>ostringstream</code>.</p>
  
  <p>When I use <code>.str()</code> what is the difference between them? Also, is there more efficient way to convert integers to strings?</p>
  
  <p>Sample code:</p>
  
  <pre><code>//using ostringstream
  
  ostringstream s1;
  int i=100;
  s1&lt;&lt;i;
  string str_i=s1.str();
  cout&lt;&lt;str_i&lt;&lt;endl;
  
  //using stringstream
  
  stringstream s2;
  int i2=100;
  s2&lt;&lt;i2;
  string str_i2=s2.str();
  cout&lt;&lt;str_i2&lt;&lt;endl;
  </code></pre>