As indicated in the section of [ostream.inserters.character]the C ++ standard, after a string charor string is inserted into a stream , the width of the stream is set to 0:
template<class traits>
basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out,
const unsigned char* s);
Do lots of sensible and expected things...
Calls width(0).
Why width(0)does the C ++ standard dictate a call ?
What is the rationality of changing the width of the flows, and not reselling it to its original value? (As far as I know, all other stream properties are saved by stream insert statements.)
There is a related question here that demonstrates the confusion this causes, but does not explain why the standard dictates this behavior.