I've seen many loops like this to read streams:
while(std::getline(iss, temp, ' ')) {
...
}
But I never understood why it worked. In the documentation for std::getline, it says that it returns the stream, and I don't understand how that is translated into a bool value. Is it reading the eof flag or something? If so, wouldn't this be more accurate:
while(!iss.eof()) {
std::getline(iss, temp, ' ');
}