About clear(). Please help!
I recently learnt from C++ Primer 4th Edition that
But it turns out that clear sets the condition states according to flag, that's, after clear is called, the condition states is equal to flag.
8.2. Condition States
s.clear(flag): Set specified condition state(s) in s to valid state. Type of flag is strm::iostate.
cin.clear(istream::failbit); // clear the failbit state
Does it mean that the author is wrong?
Or is it in the new standard, if any, that clear is used to set specified condition states to valid?
When I refered to C++ Primer 3rd Edition, I found that
I'm really very confused now!
20.7 Condition States
Using the clear() member function, we reset the condition state to an explicit value.