Section: 126.96.36.199 [string.io] Status: Dup Submitter: Steve Clamage Opened: 1998-07-09 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [string.io].
View all issues with Dup status.
Duplicate of: 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:
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.