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....
std::vector<double> myVec( 3 );
std::stringstream temp;
std::copy(myVec.begin(), myVec.end(), std::ostream_iterator<double>(temp, " "));
std::cout << temp.str() << std::endl;
std::vector<double> myVecOut;
std::copy(std::istream_iterator<double>(temp), std::istream_iterator<double>(), std::back_inserter(myVecOut));