Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added space

...

In this compliant solution, each converted value read from the standard input stream is tested for validity before reading the next value in the sequence, allowing error recovery on a per-value basis. It checks std::istream::fail() to see if the failure bit was set due to a conversion failure or whether the bad bit was set due to a loss of integrity with the stream object. If a failure condition is encountered, it is cleared on the input stream and then characters are read and discarded until a ' ' character occurs (space) character occurs. Note that the error handling in this case only works if a space character is what delimits the two numeric values to be converted.

...