Created on 1998-07-09.00:00:00 last changed 171 months ago
Rationale:
Duplicate: 25
In a comp.std.c++ posting Michel Michaud wrote: What should be output by:
string text("Hello"); cout << '[' << setw(10) << right << text << ']';
Shouldn't it be:
[ Hello]
Another person replied: Actually, according to the FDIS, the width of the field should be the minimum of width and the length of the string, so the output shouldn't have any padding. I think that this is a typo, however, and that what is wanted is the maximum of the two. (As written, setw is useless for strings. If that had been the intent, one wouldn't expect them to have mentioned using its value.)
It's worth pointing out that this is a recent correction anyway; IIRC, earlier versions of the draft forgot to mention formatting parameters whatsoever.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg155 |
1998-07-09 00:00:00 | admin | create |