Given a string foo
in Visual Studio I can break the words into a vector
by doing:
vector fooVec{ istream_iterator<string>(istringstream(foo)), istream_iterator<string>() };
But this won't compile in gcc 5.1. I get the error:
invalid initialization of non-const reference of type
std::istream_iterator<std::basic_string<char> >::istream_type&
{akastd::basic_istream<char>&
} from an rvalue of typestd::basic_istream<char>
Now I know that gcc had a bug that was fixed by our own Jonathan Wakely. Is this an extension of that bug or should it be illegal for me to use an Rvalue istringstream
here?