Title
Replace "unspecified-bool-type" by "explicit operator bool() const" in I/O library
Status
c++11
Section
[iostate.flags]
Submitter
P.J. Plauger

Created on 2009-03-24.00:00:00 last changed 153 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change the synopis in [ios]:

explicit operator unspecified-bool-type bool() const;

Change [iostate.flags]:

explicit operator unspecified-bool-type bool() const;

-1- Returns: !fail() If fail() then a value that will evaluate false in a boolean context; otherwise a value that will evaluate true in a boolean context. The value type returned shall not be convertible to int.

[Note: This conversion can be used in contexts where a bool is expected (e.g., an if condition); however, implicit conversions (e.g., to int) that can occur with bool are not allowed, eliminating some sources of user error. One possible implementation choice for this type is pointer-to-member. -- end note]

Date: 2010-10-21.18:28:33

[ 2009 Santa Cruz: ]

Moved to Ready.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We agree with the proposed resolution. Move to Review.

Date: 2012-10-21.13:19:07

Addresses JP 65 and JP 66 [CD1]

Switch from "unspecified-bool-type" to "explicit operator bool() const".

Replace operator unspecified-bool-type() const;" with explicit operator bool() const;

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg694
2010-10-21 18:28:33adminsetmessages: + msg693
2010-10-21 18:28:33adminsetmessages: + msg692
2009-03-24 00:00:00admincreate