Say I have overridden the >> operator for a class like below:
friend istream& operator>>(istream& in, MyObject& obj)
{
...
if (in.fail())
// What do I do here? Should obj be returned unmodified?
...
}
and say that the input stream is in a fail state because the data there means that I cannot get a valid MyObject out of it. How should I leave the obj object?