This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Dup status.

216. setbase manipulator description flawed

Section: 30.7.6 [std.manip] Status: Dup Submitter: Hyman Rosen Opened: 2000-02-29 Last modified: 2017-02-03

Priority: Not Prioritized

View all other issues in [std.manip].

View all issues with Dup status.

Duplicate of: 193


30.7.6 [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.


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

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