title: How to pass string retrieved from stringstream by reference?
body: <p>I have following function </p>
  
  <pre><code>void myfun(std::string &amp;str);
  </code></pre>
  
  <p>and I'm calling this functionas follows:</p>
  
  <pre><code>stringstream temp("");
  temp &lt;&lt; "some string data" ;
  myfun(temp.str());
  </code></pre>
  
  <p>but I'm getting following error:</p>
  
  <pre><code> error: no matching function for call to ‘myfun(std::basic_stringstream&lt;char&gt;::__string_type)’
  </code></pre>
  
  <p>and</p>
  
  <pre><code>no known conversion for argument 1 from ‘std::basic_stringstream&lt;char&gt;::__string_type {aka std::basic_string&lt;char&gt;}’ to ‘std::string&amp; {aka std::basic_string&lt;char&gt;&amp;}’
  </code></pre>
  
  <p>How can I pass this string by reference?</p>