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

2703. No provision for fill-padding when boolalpha is set

Section: 30.4.3.3.3 [facet.num.put.virtuals] Status: New Submitter: Hubert Tong Opened: 2016-05-07 Last modified: 2018-02-11

Priority: 3

View other active issues in [facet.num.put.virtuals].

View all other issues in [facet.num.put.virtuals].

View all issues with New status.

Discussion:

N4582 subclause 30.4.3.3.3 [facet.num.put.virtuals] paragraph 6 makes no provision for fill-padding in its specification of the behaviour when (str.flags() & ios_base::boolalpha) != 0.

[2017-07-06, Marshall comments]

All the other cases from num_putint, long, etc all are covered in 30.4.3.3.3 [facet.num.put.virtuals] p1 .. p5, which describe how to align and pad the output. (Specifically, stage 3) p6 does not.

With this description:

cout << std::setw(15) << false;

outputs:

              0
﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎// Column counter

but

cout << std::setw(15) << boolalpha << false;

outputs:

false

libc++ implements this exactly.
Dinkumware, libstdc++ and MSVC apply padding and alignment.

I think that applying padding and alignment is more appropriate.

Proposed resolution: