220 29247 <c1b30ec0-cf34-4244-9fb5-028458f5d659@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: explicit conversion from enum class to its
 underlying type
Date: Sat, 29 Oct 2016 17:31:15 -0700 (PDT)
Lines: 81
Approved: news@gmane.org
Message-ID: <c1b30ec0-cf34-4244-9fb5-028458f5d659@isocpp.org>
References: <4afed494-4fc5-4b06-b3e7-255aa293068e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1448_120075116.1477787476050"
X-Trace: blaine.gmane.org 1477787486 10295 195.159.176.226 (30 Oct 2016 00:31:26 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 30 Oct 2016 00:31:26 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBVH62TAAKGQEWVX5ULI@isocpp.org Sun Oct 30 02:31:22 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBBVH62TAAKGQEWVX5ULI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f199.google.com ([209.85.161.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBVH62TAAKGQEWVX5ULI@isocpp.org>)
	id 1c0e1r-0001MT-0o
	for gclcip-std-proposals@m.gmane.org; Sun, 30 Oct 2016 02:31:15 +0200
Original-Received: by mail-yw0-f199.google.com with SMTP id w3sf173264205ywg.1
        for <gclcip-std-proposals@m.gmane.org>; Sat, 29 Oct 2016 17:31:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=oKuDs604lDDiSz8PixasMKkw4xz8Q5iPnKTtWjxpfO4=;
        b=bDAuKPN6pc42hDkvb9fqufHBjBIGBDeg4wruwEYazbOaj3puyprpdLK5WYKjFBy5xr
         QSnBwHN8HtZz0xHfch7yBxqOIjv0WEWXYRCjWK2KSNLY5PhqmOHEn3w4Sr/huvZlraZc
         /KFp841Zh+rELC2bfxfqLNVSJXoTzOmApKudatSYpP2PIoIvxL5Wf4WrrbK9qQJKG3Xq
         B0nLoSneUUPiGDAqO+UWs2dRvZhrbPRW/qDJqGrhrCdwRxcbqL1tJCfswuoLD68q9d0a
         7nCRF+8lahYjk2sMq/e4tORtBXDSOZSAKNNMEPTHKaoH+tghBe1XhDbUa0RtoTwGJVJy
         PY/A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=oKuDs604lDDiSz8PixasMKkw4xz8Q5iPnKTtWjxpfO4=;
        b=YAL+goq60zHMZaW3H8gjyIx+hzvktVUIGb+ENsB6kTePha+1VwzxbMOmbqcFrvyC1+
         RZZTgm5K1mk9GLeFof9durqW5UbZnAFp55UUP02+b95xVkXKqB5MhpSCScYGCSgACOqA
         9u1Q9ewR2GjzM0zexr5B5AcN88hPOFJgHFdM+ZWdSNPZwzrn05DWVxb/tLzoM7JFuaTI
         dndLX+K8KxNkREyKbmoYrrcuEIBek+YnrT0gH0cRDiFDn9TKQQrrJfCg02XMB1+gLtgs
         JayILy9eluHMuBl/UEtlqubcR/WqB1AAtRSnRWM4osevXMZtRRyP3FhgtzBwsm89DlsJ
         Fksg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=oKuDs604lDDiSz8PixasMKkw4xz8Q5iPnKTtWjxpfO4=;
        b=ilRpYrLDqiY44egBZUP4opVH6ZwuP7S+H7qkGSk8f4/jifQCZCta6YSQqmEx0aYRkO
         vc7HuC3v0yme68Uym4/+QoFZSkSBxSN80ea1LgvZrqQd6rHaNgwYeo7T8KQA/6/86ze1
         cWl7mPWpnBE9qQm8JFc6k0STjPP4KQxT9ucIEifw4IQHvIb7N2Ws2rvfJk4c+SFbLcGm
         Y7UrjBbsdHzyTU5k+5g4yhOSdpDr5h/IK5wfm0Twu446aTwf9wZQdZrDbC/pZOwc2EN6
         4xT0r30S7SYFNFY1iXUojgCegmXYxlZdIJ/+x85xW+FNkp5hfE5T+hOjItW58fbQrECG
         XIMQ==
X-Gm-Message-State: ABUngvfoSxsKr2qFLM+NWXR1IjBi1sWOFA6UZmLsdjrtaCG85VX78BOCrS6YJB/GYAaKjA==
X-Received: by 10.129.117.70 with SMTP id q67mr7823216ywc.45.1477787477455;
        Sat, 29 Oct 2016 17:31:17 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.11.110 with SMTP id p43ls9675980otd.40.gmail; Sat, 29 Oct
 2016 17:31:16 -0700 (PDT)
X-Received: by 10.157.33.166 with SMTP id s35mr2410735otb.10.1477787476533;
        Sat, 29 Oct 2016 17:31:16 -0700 (PDT)
In-Reply-To: <4afed494-4fc5-4b06-b3e7-255aa293068e@isocpp.org>
X-Original-Sender: jmckesson@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:29247
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29247>

------=_Part_1448_120075116.1477787476050
Content-Type: multipart/alternative; 
	boundary="----=_Part_1449_1965648314.1477787476050"

------=_Part_1449_1965648314.1477787476050
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Saturday, October 29, 2016 at 5:51:12 PM UTC-4, Andrzej Krzemie=C5=84ski=
=20
wrote:
>
> Hi All,
>
> One of the nice safety features of enum classes is that they cannot be=20
> implicitly converted to their underlying type. However, do you think we=
=20
> would lose this safety feature if we allowed an explicit conversion to th=
e=20
> underlying type?
>
> I do not know of any practical use of explicit conversion operators excep=
t=20
> for the contextual conversion to bool. And it is only this conversion tha=
t=20
> I am interested in.
>

So, what you're asking for is if the underlying type of a strong enum is=20
`bool`, then that type can be contextually converted to `bool`. I don't=20
think it's worth adding a language feature for such an incredibly narrow=20
corner case.

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/c1b30ec0-cf34-4244-9fb5-028458f5d659%40isocpp.or=
g.

------=_Part_1449_1965648314.1477787476050
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Saturday, October 29, 2016 at 5:51:12 PM UTC-4, Andrzej=
 Krzemie=C5=84ski wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr">Hi All,<br><br>One of the nice safety features of enum classes i=
s that they cannot be implicitly converted to their underlying type. Howeve=
r, do you think we would lose this safety feature if we allowed an explicit=
 conversion to the underlying type?<br><br>I do not know of any practical u=
se of explicit conversion operators except for the contextual conversion to=
 bool. And it is only this conversion that I am interested in.<br></div></b=
lockquote><div><br>So, what you&#39;re asking for is if the underlying type=
 of a strong enum is `bool`, then that type can be contextually converted t=
o `bool`. I don&#39;t think it&#39;s worth adding a language feature for su=
ch an incredibly narrow corner case.</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c1b30ec0-cf34-4244-9fb5-028458f5d659%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c1b30ec0-cf34-4244-9fb5-028458f5d659=
%40isocpp.org</a>.<br />

------=_Part_1449_1965648314.1477787476050--

------=_Part_1448_120075116.1477787476050--

.
