220 32834 <88f0eeb9-c80f-4245-8231-bddacda98832@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Halfdan Ingvarsson <halfdan@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: std::enum
Date: Wed, 21 Jun 2017 05:38:53 -0700 (PDT)
Lines: 80
Approved: news@gmane.org
Message-ID: <88f0eeb9-c80f-4245-8231-bddacda98832@isocpp.org>
References: <1cdd0fbf-c65d-4034-82d1-a84d4c4f6d1c@isocpp.org>
 <546143ae-5acd-4a0e-abde-4f712c51ca30@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3150_985148847.1498048733266"
X-Trace: blaine.gmane.org 1498048734 17407 195.159.176.226 (21 Jun 2017 12:38:54 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 21 Jun 2017 12:38:54 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD5MZ4NLUIMRBXORVHFAKGQEJUVXNMI@isocpp.org Wed Jun 21 14:38:49 2017
Return-path: <std-proposals+bncBD5MZ4NLUIMRBXORVHFAKGQEJUVXNMI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f70.google.com ([209.85.214.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBD5MZ4NLUIMRBXORVHFAKGQEJUVXNMI@isocpp.org>)
	id 1dNeuH-0004Ej-DW
	for gclcip-std-proposals@m.gmane.org; Wed, 21 Jun 2017 14:38:49 +0200
Original-Received: by mail-it0-f70.google.com with SMTP id u127sf2749164itg.11
        for <gclcip-std-proposals@m.gmane.org>; Wed, 21 Jun 2017 05:38:55 -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
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=0JNQ5naL9xLojDnGDpiuPnVvl9PqHiNkM4zCjgjfZDU=;
        b=JmTz2Uuodcw/qJ4vwECVJvuE5fMEVAJvwequ52y0QjEbVEsRREaYFfzqVb8PeUOyKt
         vtCRKodMfp5q9M5tq5Qr8CB3tBtmzJknU/H2B5J1bx2rDJ7QHSJWYlKSZVJrJQaXLjef
         eqIP2JOtDwDDc+CQNVgTc4Z+CqhzfAd5e2L42bxxTgEcplZyZlp4vKwNQDRyHDLczoAK
         vMm3Eso2NcyWvjVo6usVTjuARM0uFTYCbGqlz1peStDOPVd+oOm7JMKMcUhl5DB20CAM
         RAiBdrsDzqoccQ/0eoDjx+TpUT603NDgcIhVakF3yKSkr3dAvNX9dslDsyfv7GdS2MM5
         d6og==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=0JNQ5naL9xLojDnGDpiuPnVvl9PqHiNkM4zCjgjfZDU=;
        b=jVWgTXC37FVoxuaJpc7T0dlmYMyhGzl6ynyqTZ88JzA8IiapGOjQjL0CNc2KOfkNhU
         P/wCz84zw0AySJptbsoc940/Ud4JX/f+oypknf8Yh6LXtI7xCL15Iv3YPw80TUZp7sHI
         NlU7nrMjAJuldCm2DaB4TW0dE0BjWTXGuB1ial+F+WqOGeiYV+SMYnzXYo5xjlsVFAwy
         qGL6y1yP0Y74Iq+0Bwzz8niAYK/u6fiCs6bB9qyEiplYzF5synln+mhd/t84bYP9KRHX
         rjmZIim+PvU2CUJ6amtQsp/wZZEUM0OXxnJ9IZEQHoRBMO0kTStp0+1tN3LsLjV5J+kB
         iQCw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        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=0JNQ5naL9xLojDnGDpiuPnVvl9PqHiNkM4zCjgjfZDU=;
        b=QRAgpg0NQXEdvPGsE0yt5b45CN4J6JHoZSadTK52nfG9yghSJ/2TwcyCMFNbfITJ+/
         8oEwwyj5pChqqORtKz+HaOJLZY+3z6R0GwJw/U+4nTuA3HDdfP7Xf5zZNAAvb/vTMrsA
         VJOcD+8CLfYo3xqtfosGwrCU5IUg0L0jdTnWNSZ+fh/TXa7tVQCRoklhuzuVAD17o2+W
         GOVRb5wfqxyA8kSThpXTZ++gRvqHY1SGNI7nROnukdqBaomI6Pa9F6tDZuIkd62RiBsF
         rpT6kQcGiCTVMbRna/IthGodfju5pj1bM/P7W44zKP2vByPBagzT920NZSMNaEb9TkuD
         srXA==
X-Gm-Message-State: AKS2vOx8LAdj38twBOoHAhAGFNrWvvcCHHelbzumH0LX5IgGMmIS34Bw
	XbI12+1iNagmRevb
X-Received: by 10.107.27.198 with SMTP id b189mr17739665iob.38.1498048734503;
        Wed, 21 Jun 2017 05:38:54 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.29.194 with SMTP id w2ls3918770otw.28.gmail; Wed, 21 Jun
 2017 05:38:53 -0700 (PDT)
X-Received: by 10.157.12.161 with SMTP id b30mr1087415otb.3.1498048733752;
        Wed, 21 Jun 2017 05:38:53 -0700 (PDT)
In-Reply-To: <546143ae-5acd-4a0e-abde-4f712c51ca30@isocpp.org>
X-Original-Sender: halfdan@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:32834
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32834>

------=_Part_3150_985148847.1498048733266
Content-Type: multipart/alternative; 
	boundary="----=_Part_3151_427242366.1498048733266"

------=_Part_3151_427242366.1498048733266
Content-Type: text/plain; charset="UTF-8"



On Wednesday, June 21, 2017 at 12:12:44 AM UTC-4, wei zhang wrote:
>
> I won't think it can be done with only add lib.
> For the samething I would suggest enum class will have a static const 
> variable array.
> so that you could write
> const auto & e =Color.array
>

That's why I mentioned that it would have to have some help from the 
compiler.

For example, std::underlying_type, on clang and gcc, rely on an intrinsic 
called __underlying_type(), which takes a type argument. In this case there 
needs to be something like __enum_members(), which would be substituted by 
an braced init list that contains the enum members at compile time.

-- 
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 email 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/88f0eeb9-c80f-4245-8231-bddacda98832%40isocpp.org.

------=_Part_3151_427242366.1498048733266
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, June 21, 2017 at 12:12:44 AM UTC-4, =
wei zhang wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r">I won&#39;t think it can be done with only add lib.<div>For the samethin=
g I would suggest enum class will have a static const variable array.</div>=
<div>so that you could write</div><div><div style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px;word-wrap:break-word"><code><div><font color=3D"#000000"><span style=3D"=
color:#008">const</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">auto</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">&amp;</span><span style=3D"color:#000"> e </span><span style=3D"co=
lor:#660">=3D</span><span style=3D"color:#606">Color</span><span style=3D"c=
olor:#660">.</span><span style=3D"color:#000">array</span></font></div></co=
de></div></div></div></blockquote><div><br></div><div>That&#39;s why I ment=
ioned that it would have to have some help from the compiler.</div><div><br=
></div><div>For example, std::underlying_type, on clang and gcc, rely on an=
 intrinsic called __underlying_type(), which takes a type argument. In this=
 case there needs to be something like __enum_members(), which would be sub=
stituted by an braced init list that contains the enum members at compile t=
ime.</div><div><br></div><style type=3D"text/css">
p, li { white-space: pre-wrap; }
</style>
</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/88f0eeb9-c80f-4245-8231-bddacda98832%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/88f0eeb9-c80f-4245-8231-bddacda98832=
%40isocpp.org</a>.<br />

------=_Part_3151_427242366.1498048733266--

------=_Part_3150_985148847.1498048733266--

.
