vendredi 2 octobre 2015

C++11 - drop input from stream

When I have a program that may take up to n lines of input to solve a problem before starting with the next, I need to throw away all lines of input that belong to the old problem when the program can solve it before having read all the input.

I could, of course, simply loop until I reach the new problem's input, but reading and storing all that data may be expensive. Is there no way to simply tell the input stream to ignore the next so-and-so-many values?

Aucun commentaire:

Enregistrer un commentaire