This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
explicit operator bool() const
" in I/O librarySection: 31.5.4.4 [iostate.flags] Status: C++11 Submitter: P.J. Plauger Opened: 2009-03-24 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [iostate.flags].
View all issues with C++11 status.
Discussion:
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;
[ Batavia (2009-05): ]
We agree with the proposed resolution. Move to Review.
[ 2009 Santa Cruz: ]
Moved to Ready.
Proposed resolution:
Change the synopis in 31.5.4 [ios]:
explicit operatorunspecified-bool-typebool() const;
Change 31.5.4.4 [iostate.flags]:
explicit operatorunspecified-bool-typebool() const;-1- Returns:
!fail()
Iffail()
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., anif
condition); however, implicit conversions (e.g., toint
) that can occur withbool
are not allowed, eliminating some sources of user error. One possible implementation choice for this type is pointer-to-member. -- end note]