220 29268 <CAOenAXg3vcFOkVFd8MWXuBeDE4rJhSK15SrK2KeAGZLBY4kPOg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Andrzej Krzemienski <akrzemi1@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: explicit conversion from enum class to its
 underlying type
Date: Mon, 31 Oct 2016 09:14:59 +0100
Lines: 94
Approved: news@gmane.org
Message-ID: <CAOenAXg3vcFOkVFd8MWXuBeDE4rJhSK15SrK2KeAGZLBY4kPOg@mail.gmail.com>
References: <4afed494-4fc5-4b06-b3e7-255aa293068e@isocpp.org> <c1b30ec0-cf34-4244-9fb5-028458f5d659@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=e89a8fb1eae8d94dac054024cdb5
X-Trace: blaine.gmane.org 1477901721 26151 195.159.176.226 (31 Oct 2016 08:15:21 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 31 Oct 2016 08:15:21 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDT2DGOJ34DBBB733PAAKGQEGX3KI4A@isocpp.org Mon Oct 31 09:15:17 2016
Return-path: <std-proposals+bncBDT2DGOJ34DBBB733PAAKGQEGX3KI4A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f70.google.com ([74.125.82.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDT2DGOJ34DBBB733PAAKGQEGX3KI4A@isocpp.org>)
	id 1c17kC-0004O6-W7
	for gclcip-std-proposals@m.gmane.org; Mon, 31 Oct 2016 09:15:01 +0100
Original-Received: by mail-wm0-f70.google.com with SMTP id 79sf64818319wmy.6
        for <gclcip-std-proposals@m.gmane.org>; Mon, 31 Oct 2016 01:15:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=GYZ6Sm0QqcdRkAAGA6NSJ/ox78n6FLI9ciG71GxyhlI=;
        b=W0a6YOqgmowQ8lAVxuWa5sqmBp1DNHxQQZLzY8sSMXR+6rdbx5TLo75ojoefP2xihy
         6mSDjjZziuDWNkzipJhv6+ujRi9gmt8O3I0yQ07AFHFgswJH+SVeSSmJtMAeGFQeKm6n
         ddGggBtOzN0kL4T8hVZ6NDuJYmYJPnBEVnk7J13PgIaGUEwXpPE/F/u6YktmVlEjENmZ
         b13/jskbO2ze9dsUID3iOWYB/R3zyW3yVWQhMxdBQS0r2E6/UMFX5Hac2DChhU4sE+bl
         RWk9U2qqx31g7GltJSQKUVMuoHpR5eP0r+E8QLoZs4vfjxqq+1Ts9iinhXFN6XnZg8GX
         GEXQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=GYZ6Sm0QqcdRkAAGA6NSJ/ox78n6FLI9ciG71GxyhlI=;
        b=G5XkflxTSBD4oDenG60EOdwKuccwfiazmUU6GlEhsz0Wm7oR88CnL2kQqmFcveV8hT
         5Bv+X7BUsw4stta3de3j/LntKyVgVJVnoNPjeywtidmrgBcBHOjH0eorTuuRZIWr0MmO
         gFqTKDVzdrx6gkpS09Zi95lEbD0Xpr3lvkiZ701mbqVwO0mF2e7doMS3PmtxmuVs4/yp
         4AuSHbPfqM3aWZ13ZCJL+BC/ZmB05JrHxR0B/Qhkb7HMEGL/kw2fGL0bIkgyKMOupIh8
         vw6rnsAlrmpCfE0q0TCsGBSAaXKTl8VI7w6WxzZPu8Gmc3PT5DS9zUsl5P/dnjrWC787
         iD7g==
X-Gm-Message-State: ABUngvfD9MUeAcFgRhxU1/qcWBF/9xhHpPaUbTsIIzONIPlr6CfSNiZdFv9oF9QxHTpRDA==
X-Received: by 10.28.26.10 with SMTP id a10mr721690wma.20.1477901703869;
        Mon, 31 Oct 2016 01:15:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.165.9 with SMTP id o9ls1326226wme.5.gmail; Mon, 31 Oct 2016
 01:15:00 -0700 (PDT)
X-Received: by 10.194.68.106 with SMTP id v10mr21483568wjt.149.1477901700640;
        Mon, 31 Oct 2016 01:15:00 -0700 (PDT)
Original-Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com. [2a00:1450:400c:c09::234])
        by mx.google.com with ESMTPS id me20si28159442wjb.81.2016.10.31.01.15.00
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 31 Oct 2016 01:15:00 -0700 (PDT)
Received-SPF: pass (google.com: domain of akrzemi1@gmail.com designates 2a00:1450:400c:c09::234 as permitted sender) client-ip=2a00:1450:400c:c09::234;
Original-Received: by mail-wm0-x234.google.com with SMTP id n67so213516163wme.1
        for <std-proposals@isocpp.org>; Mon, 31 Oct 2016 01:15:00 -0700 (PDT)
X-Received: by 10.194.106.169 with SMTP id gv9mr21017977wjb.129.1477901700122;
 Mon, 31 Oct 2016 01:15:00 -0700 (PDT)
Original-Received: by 10.80.186.55 with HTTP; Mon, 31 Oct 2016 01:14:59 -0700 (PDT)
In-Reply-To: <c1b30ec0-cf34-4244-9fb5-028458f5d659@isocpp.org>
X-Original-Sender: akrzemi1@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of akrzemi1@gmail.com
 designates 2a00:1450:400c:c09::234 as permitted sender) smtp.mailfrom=akrzemi1@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=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:29268
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29268>

--e89a8fb1eae8d94dac054024cdb5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

2016-10-30 2:31 GMT+02:00 Nicol Bolas <jmckesson@gmail.com>:

> On Saturday, October 29, 2016 at 5:51:12 PM UTC-4, Andrzej Krzemie=C5=84s=
ki
> wrote:
>>
>> Hi All,
>>
>> One of the nice safety features of enum classes is that they cannot be
>> implicitly converted to their underlying type. However, do you think we
>> would lose this safety feature if we allowed an explicit conversion to t=
he
>> underlying type?
>>
>> I do not know of any practical use of explicit conversion operators
>> except for the contextual conversion to bool. And it is only this
>> conversion that I am interested in.
>>
>
> So, what you're asking for is if the underlying type of a strong enum is
> `bool`, then that type can be contextually converted to `bool`. I don't
> think it's worth adding a language feature for such an incredibly narrow
> corner case.
>
> But are you saying that the process of pushing this change into the
language is too expensive to warrant the satisfaction of a marginal use
case? Or are you saying that satisfying one small use case is over-weighed
by potential type safety hole that would come with the change?

Regards,
&rzej;

--=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/CAOenAXg3vcFOkVFd8MWXuBeDE4rJhSK15SrK2KeAGZLBY4k=
POg%40mail.gmail.com.

--e89a8fb1eae8d94dac054024cdb5
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">2016-10-30 2:31 GMT+02:00 Nicol Bolas <span dir=3D"ltr">&lt;<a href=3D"=
mailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>&gt;</=
span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span class=3D"">=
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.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hi All,<br>=
<br>One of the nice safety features of enum classes is that they cannot be =
implicitly converted to their underlying type. However, do you think we wou=
ld lose this safety feature if we allowed an explicit conversion to the und=
erlying type?<br><br>I do not know of any practical use of explicit convers=
ion operators except for the contextual conversion to bool. And it is only =
this conversion that I am interested in.<br></div></blockquote></span><div>=
<br>So, what you&#39;re asking for is if the underlying type of a strong en=
um is `bool`, then that type can be contextually converted to `bool`. I don=
&#39;t think it&#39;s worth adding a language feature for such an incredibl=
y narrow corner case.</div></div><span class=3D"">

<p></p></span></blockquote><div>But are you saying that the process of push=
ing this change into the language is too expensive to warrant the satisfact=
ion of a marginal use case? Or are you saying that satisfying one small use=
 case is over-weighed by potential type safety hole that would come with th=
e change?<br><br></div><div>Regards,<br></div><div>&amp;rzej; <br></div></d=
iv><br></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/CAOenAXg3vcFOkVFd8MWXuBeDE4rJhSK15SrK=
2KeAGZLBY4kPOg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOenAXg3vcFOkVFd=
8MWXuBeDE4rJhSK15SrK2KeAGZLBY4kPOg%40mail.gmail.com</a>.<br />

--e89a8fb1eae8d94dac054024cdb5--

.
