Title
setbase manipulator description flawed
Status
dup
Section
[std.manip]
Submitter
Hyman Rosen

Created on 2000-02-29.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

[ Tokyo: The LWG agrees that this is a defect and notes that it occurs additional places in the section, all requiring fixes. ]

Duplicate: 193

Date: 2010-10-21.18:28:33

Rationale:

The resolution of this defect is subsumed by the proposed resolution for issue 193.

Date: 2000-02-29.00:00:00

[std.manip] paragraph 5 says:

smanip setbase(int base);

Returns: An object s of unspecified type such that if out is an (instance of) basic_ostream then the expression out<<s behaves as if f(s) were called, in is an (instance of) basic_istream then the expression in>>s behaves as if f(s) were called. Where f can be defined as:

ios_base& f(ios_base& str, int base)
{
  // set basefield
  str.setf(n == 8 ? ios_base::oct :
                n == 10 ? ios_base::dec :
                n == 16 ? ios_base::hex :
                  ios_base::fmtflags(0), ios_base::basefield);
  return str;
}

There are two problems here. First, f takes two parameters, so the description needs to say that out<<s and in>>s behave as if f(s,base) had been called. Second, f is has a parameter named base, but is written as if the parameter was named n.

Actually, there's a third problem. The paragraph has grammatical errors. There needs to be an "and" after the first comma, and the "Where f" sentence fragment needs to be merged into its preceding sentence. You may also want to format the function a little better. The formatting above is more-or-less what the Standard contains.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1883
2010-10-21 18:28:33adminsetmessages: + msg1882
2000-02-29 00:00:00admincreate