Actually, I dont know, or fully understand, the details either.Can someone explain with more details, please?
I've been digging up the C++ standard, and so far have found:
From basic_istream (18.104.22.168):
Effects: Behaves as an unformatted input function (as described in 22.214.171.124, paragraph 1), except that it
does not count the number of characters extracted and does not affect the value returned by subsequent
calls to gcount(). After constructing a sentry object, if rdbuf() is a null pointer, returns -1 . Otherwise,
calls rdbuf()->pubsync() and, if that function returns -1 calls setstate(badbit)
(which may throw ios_base::failure (126.96.36.199), and returns -1. Otherwise, returns zero.
From basic_streambuf (188.8.131.52.2):
From basic_streambuf (184.108.40.206.2):
Effects: Synchronizes the controlled sequences with the arrays. That is, if pbase() is non-null the characters
between pbase() and pptr() are written to the controlled sequence. The pointers may then
be reset as appropriate.
Returns: -1 on failure. What constitutes failure is determined by each derived class (220.127.116.11).
Default behavior: Returns zero.
From basic_streambuf (18.104.22.168.2):
char_type* pbase() const;
Returns: The beginning pointer for the output sequence.
char_type* pptr() const;
Returns: The next pointer for the output sequence.
Somehow cin.sync() effectively seems to flush the input buffer, from what I see.