Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


1320. Converting scoped enumerations tobool

Section:7.6.1.9  [expr.static.cast]    Status:CD3    Submitter:Jonathan Wakely    Date:2011-05-18

[Moved to DR at the April, 2013 meeting.]

The specification ofstatic_cast (7.6.1.9 [expr.static.cast])does not describe conversion of a scoped enumeration value tobool. Presumably it should be handled as for unscopedenumerations, with a zero value becomingfalse and a non-zerovalue becomingtrue.

Proposed resolution (August, 2012):

Change 7.6.1.9 [expr.static.cast] paragraph 9 as follows:

A value of a scoped enumeration type (9.8.1 [dcl.enum]) can beexplicitly converted to an integral type.TheWhenthat type iscvbool, the resulting value isfalse if the original value is zero andtrue for allother values. For the remaining integral types, the value isunchanged if the original value can be represented by the specifiedtype. Otherwise, the resulting value is unspecified.



[8]ページ先頭

©2009-2026 Movatter.jp