setprecision()
and setw()
Section: 31.7 [iostream.format] Status: NAD Submitter: Marc Steinbach Opened: 2009-06-20 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [iostream.format].
View all issues with NAD status.
Discussion:
The header <iomanip>
synopsis in 31.7 [iostream.format] specifies
T5 setprecision(int n); T6 setw(int n);
The argument types should be streamsize, as in class ios_base
(see 31.5.2 [ios.base]):
streamsize precision() const; streamsize precision(streamsize prec); streamsize width() const; streamsize width(streamsize wide);
(Editorial: 'wide' should probably be renamed as 'width', or maybe just 'w'.)
[ 2009-07-29 Daniel clarified wording. ]
[ 2009 Santa Cruz: ]
No concensus for this change. There was some interest in doing the opposite fix: Change the
streamsize
in<ios>
toint
. But ultimately there was no concensus for that change either.
Proposed resolution:
In 31.7 [iostream.format], header <iomanip>
synopsis change as indicated:
T5 setprecision(intstreamsize n); T6 setw(intstreamsize n);
In 31.7.7 [std.manip], just before p. 6 change as indicated:
unspecified setprecision(intstreamsize n);
In 31.7.7 [std.manip], just before p. 7 change as indicated:
unspecified setw(intstreamsize n);