title: C++11 std::to_string(double) - No trailing zeros
body: <p>Today I tried out some new functions of the C++11 STL and encountered <code>std::to_string</code>.</p>
  
  <p>Lovely, lovely set of functions. Creating a stringstream object for just one double-to-string conversion always seemed overkill to me, so I'm glad we can now do something like this:</p>
  
  <pre><code>std::cout &lt;&lt; std::to_string(0.33) &lt;&lt; std::endl;
  </code></pre>
  
  <p>The result?</p>
  
  <pre><code>0.330000
  </code></pre>
  
  <p>I'm not entirely content with that. Is there a way to tell <code>std::to_string</code> to leave out the trailing zeros? I searched the internet, but as far as I can see the function takes only one argument (the value to be converted). Back in 'the old days' with stringstreams, you could set the width of the stream, but I'd rather not convert back.</p>
  
  <p>Anyone encountered this problem before/has a solution? Some StackOverflow searches yielded nothing.</p>
  
  <p>(A C++11 STL reference: <a href="http://en.cppreference.com/w/cpp/string/basic_string/to_string">http://en.cppreference.com/w/cpp/string/basic_string/to_string</a>)</p>