title: Converting double to string function - memory issues?
body: <p>I find myself having to std::cout various double variables.
  I've made a simple function to convert a double to a std::string, which I can then use with std::cout etc.</p>
  
  <pre><code>// Convert a double to a string.
  std::string dtos(double x) {
      std::stringstream s;
      s &lt;&lt; x;
      return s.str();
  }
  </code></pre>
  
  <p>The function seems to work OK, but my question is: does this approach have any (bad) memory implications ie. am I allocating unecessary memory, or leaving anything 'dangling'?</p>
  
  <p>Thanks guys
  Pete</p>