3937. I/O manipulators should be specified in terms of base classes

Section: 31.7.7 [std.manip], 31.7.8 [ext.manip], 31.7.9 [quoted.manip] Status: New Submitter: Jonathan Wakely Opened: 2023-05-25 Last modified: 2023-06-01

Priority: 3

View all other issues in [std.manip].

View all issues with New status.

Discussion:

All the manipulators in 31.7.7 [std.manip] and 31.7.8 [ext.manip] use language of the form:

An object of unspecified type such that if out is an object of type basic_ostream<charT, traits> then the expression out << resetiosflags(mask) behaves as if [...]

This needs to work for any object with a public and unambiguous base class of type basic_ostream<charT, traits>, not only objects of exactly that type.

In C++98 and C++03, setfill did actually get this right ("if out is (or is derived from) basic_ostream<charT,traits>"), but that was "fixed" for C++11 to be consistent with the other manipulators.

31.7.9 [quoted.manip] is slightly different, talking about "an instance of basic_ostream", but that's not right either.

[2023-06-01; Reflector poll]

Set priority to 3 after reflector poll.

Proposed resolution: