Cannot explain why std::istream_iterator set std::ios_base in error state
<p>I am trying to conert a vector into a stream and back.
While the first part works without issues, the last line of the following code put std::ios_base is an error state. Have you got any idea why it is so?
Apparently myVecOut is equal to myVec after the code executes....</p>

<pre><code>    std::vector&lt;double&gt; myVec( 3 );
    std::stringstream temp;
    std::copy(myVec.begin(), myVec.end(), std::ostream_iterator&lt;double&gt;(temp, " "));
    std::cout &lt;&lt; temp.str() &lt;&lt; std::endl;
    std::vector&lt;double&gt; myVecOut;
    std::copy(std::istream_iterator&lt;double&gt;(temp), std::istream_iterator&lt;double&gt;(), std::back_inserter(myVecOut));
</code></pre>
