220 31433 <8cde95ae-23fe-442f-9bf2-5c040f05efde@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Konstantin Frumkin <fro0mberg@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Let the developer to know number of items in enum at
 compile time. STD proposal.
Date: Sun, 5 Mar 2017 23:57:49 -0800 (PST)
Lines: 116
Approved: news@gmane.org
Message-ID: <8cde95ae-23fe-442f-9bf2-5c040f05efde@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1334_461285828.1488787069628"
X-Trace: blaine.gmane.org 1488787073 664 195.159.176.226 (6 Mar 2017 07:57:53 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 6 Mar 2017 07:57:53 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDVZB7HC2UMBB7VM6TCQKGQEZO5QBRI@isocpp.org Mon Mar 06 08:57:49 2017
Return-path: <std-proposals+bncBDVZB7HC2UMBB7VM6TCQKGQEZO5QBRI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f197.google.com ([209.85.161.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDVZB7HC2UMBB7VM6TCQKGQEZO5QBRI@isocpp.org>)
	id 1cknWb-0007wb-8k
	for gclcip-std-proposals@m.gmane.org; Mon, 06 Mar 2017 08:57:45 +0100
Original-Received: by mail-yw0-f197.google.com with SMTP id k13sf13127579ywk.2
        for <gclcip-std-proposals@m.gmane.org>; Sun, 05 Mar 2017 23:57:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id: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=Yyx0PynU5522kv6sRNWC+SPu5CSTzuEvUQvq7aYdX1E=;
        b=BCytJ8ZsEYXto9AG8RyJQS0tVKUWcSDqSeAIeOk6Wbt5c5N1lCrqPMBr7C+o76QB7A
         JKqdijdr4xdnlfswOTISsO2JopTk4V/1bewYqVHJYiSmNAaIYUm0yUQ33BQ99g4hydyG
         QUjJIA0BH+IaHlfqSaPlOPBLAbxGjHowLJlz+P/j0vyXuJv1yw0pVA1IaT7SNHet2rtJ
         SIe1/O7qS76+jm1AG0LcdA1RPsTAP1w1JVxS50iwB3GrWZwVwSdYKo1Qn5wgAFCkk/Wj
         zw+yeBW/85hxVQYpFUscOD8wS6ry9ZTj3aN9sxNkuItO1J5EehRPZe0ojsyQTnM3esSO
         O0wQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id: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=Yyx0PynU5522kv6sRNWC+SPu5CSTzuEvUQvq7aYdX1E=;
        b=nGGiaMPaVu6CTWMV4NhE8/bwI/p9bEU3lFjnT7WSDu2k7ovDO7rk75n1pvzNWzb40w
         MLjUbSbcg0wh0R/0c4gk4reieIMrxoJcLW6wA8AUynsivmH0epkranUgQ0yBDuVn97QK
         wtRIffrrdQYos6KnlXp/7MeZuwRO50kPgNM7tsOyq7KGJh5BIm1JdFxtHkYLm+fW+7+l
         FsdfDD5/bl8sIhBP3UBZMXecMe8npszVyKYPLuFuLRFArg3yLGxduUhp0mjXa+laoihw
         H9AcUdBufASNmln+lr2G6HRidIhYDszWl6H4WVP4vyqWGnCsDkBG526g4xt49ZB0L+Sk
         vOOg==
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: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=Yyx0PynU5522kv6sRNWC+SPu5CSTzuEvUQvq7aYdX1E=;
        b=H8HYi7ZBAmO7r9a9DRpqrBb6hJcN+XABTcKHXGnf64OKCFd1+/ZfBO+BVn6yLooKa9
         hzxydRVhD7dfLYe92pj/6NHeD3qUPSVJLdA/dklsIoAo17vsiHw6SXCyl1/13iRGQAwT
         S5D2ikEAvW3F+VcKqKp9KnMLHd+eGJ3W59LITdUWpFP+D5FvXCgmt04lCnLddmL9wzpk
         mIFyPZrL80ftYHAyTPmyMUS74C0tUf2kvsVsfJPqqSlg0O3+KgACUO7I9EEIKwLCUBn4
         Y6HVeRyDGJ7GzzshmdDfZXXkdRjCFGnoNqMM6Cja9agenFXSuUqkN7zdnddgjTb69NSj
         UuQQ==
X-Gm-Message-State: AMke39mk1Qsw5galvNfJXN2uQRguUSYX9K6M5ZmOprvetAZ0L/53E1bO5NmFrhN7pnh33w==
X-Received: by 10.13.252.194 with SMTP id m185mr5772741ywf.145.1488787071140;
        Sun, 05 Mar 2017 23:57:51 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.51.92 with SMTP id u28ls15947710otd.12.gmail; Sun, 05 Mar
 2017 23:57:50 -0800 (PST)
X-Received: by 10.157.32.3 with SMTP id n3mr1076139ota.1.1488787070279;
        Sun, 05 Mar 2017 23:57:50 -0800 (PST)
X-Original-Sender: fro0mberg@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:31433
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31433>

------=_Part_1334_461285828.1488787069628
Content-Type: multipart/alternative; 
	boundary="----=_Part_1335_740211968.1488787069628"

------=_Part_1335_740211968.1488787069628
Content-Type: text/plain; charset=UTF-8

For now developers have to use crutches like 
enumFoobar{Foo,Bar,Baz,Quz, length =4};



this may be not safe and not robust.
Let the developer access the length value implicitly at compile time like

enumFoobar{foo, bar, baz, quz};
intNumberOfIemsInFoobar=Foobar::length;// 

NumberOfIemsInFoobar is 4 during runtime


Make C++ more sweet!

-- 
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/8cde95ae-23fe-442f-9bf2-5c040f05efde%40isocpp.org.

------=_Part_1335_740211968.1488787069628
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">For now developers have to use crutches like <br><div clas=
s=3D"m_-7574783336619094805prettyprint" style=3D"background-color:#fafafa;b=
order-color:#bbbbbb;border-style:solid;border-width:1px"><div class=3D"m_-7=
574783336619094805subprettyprint"><span class=3D"m_-7574783336619094805styl=
ed-by-prettify" style=3D"color:#008">enum</span><span class=3D"m_-757478333=
6619094805styled-by-prettify" style=3D"color:#606">Foobar</span><span class=
=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#660">{</span>=
<span class=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#60=
6">Foo</span><span class=3D"m_-7574783336619094805styled-by-prettify" style=
=3D"color:#660">,</span><span class=3D"m_-7574783336619094805styled-by-pret=
tify" style=3D"color:#606">Bar</span><span class=3D"m_-7574783336619094805s=
tyled-by-prettify" style=3D"color:#660">,</span><span class=3D"m_-757478333=
6619094805styled-by-prettify" style=3D"color:#606">Baz</span><span class=3D=
"m_-7574783336619094805styled-by-prettify" style=3D"color:#660">,</span><sp=
an class=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#606">=
Quz</span><span class=3D"m_-7574783336619094805styled-by-prettify" style=3D=
"color:#660">,</span><span class=3D"m_-7574783336619094805styled-by-prettif=
y" style=3D"color:#000"> length </span><span class=3D"m_-757478333661909480=
5styled-by-prettify" style=3D"color:#660">=3D</span><span class=3D"m_-75747=
83336619094805styled-by-prettify" style=3D"color:#066">4</span><span class=
=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#660">};</span=
><span class=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#0=
00"><br></span></div></div><pre class=3D"m_-7574783336619094805lang-cpp m_-=
7574783336619094805prettyprint m_-7574783336619094805prettyprinted"><code><=
span class=3D"m_-7574783336619094805pun"><br><br>this may be not safe and n=
ot robust.<br>Let the developer access the length value implicitly at compi=
le time like<br></span></code><code></code></pre><div class=3D"m_-757478333=
6619094805prettyprint" style=3D"background-color:#fafafa;border-color:#bbbb=
bb;border-style:solid;border-width:1px"><div class=3D"m_-757478333661909480=
5subprettyprint"><span class=3D"m_-7574783336619094805styled-by-prettify" s=
tyle=3D"color:#008">enum</span><span class=3D"m_-7574783336619094805styled-=
by-prettify" style=3D"color:#606">Foobar</span><span class=3D"m_-7574783336=
619094805styled-by-prettify" style=3D"color:#660">{</span><span class=3D"m_=
-7574783336619094805styled-by-prettify" style=3D"color:#000">foo</span><spa=
n class=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#660">,=
</span><span class=3D"m_-7574783336619094805styled-by-prettify" style=3D"co=
lor:#000"> bar</span><span class=3D"m_-7574783336619094805styled-by-prettif=
y" style=3D"color:#660">,</span><span class=3D"m_-7574783336619094805styled=
-by-prettify" style=3D"color:#000"> baz</span><span class=3D"m_-75747833366=
19094805styled-by-prettify" style=3D"color:#660">,</span><span class=3D"m_-=
7574783336619094805styled-by-prettify" style=3D"color:#000"> quz</span><spa=
n class=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#660">}=
;</span><span class=3D"m_-7574783336619094805styled-by-prettify" style=3D"c=
olor:#000"><br></span><span class=3D"m_-7574783336619094805styled-by-pretti=
fy" style=3D"color:#008">int</span><span class=3D"m_-7574783336619094805sty=
led-by-prettify" style=3D"color:#606">NumberOfIemsInFoobar</span><span clas=
s=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#660">=3D</sp=
an><span class=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:=
#606">Foobar</span><span class=3D"m_-7574783336619094805styled-by-prettify"=
 style=3D"color:#660"><wbr>::</span><span class=3D"m_-7574783336619094805st=
yled-by-prettify" style=3D"color:#000">length</span><span class=3D"m_-75747=
83336619094805styled-by-prettify" style=3D"color:#660">;</span><span class=
=3D"m_-7574783336619094805styled-by-prettify" style=3D"color:#800">// </spa=
n><br><pre class=3D"m_-7574783336619094805lang-cpp m_-7574783336619094805pr=
ettyprint m_-7574783336619094805prettyprinted"><code><code class=3D"m_-7574=
783336619094805prettyprint"><span class=3D"m_-7574783336619094805styled-by-=
prettify" style=3D"color:#606">NumberOfIemsInFoobar</span><span class=3D"m_=
-7574783336619094805styled-by-prettify" style=3D"color:#000"> is 4 during r=
untime</span></code></code></pre></div></div><pre class=3D"m_-7574783336619=
094805lang-cpp m_-7574783336619094805prettyprint m_-7574783336619094805pret=
typrinted"><code><span class=3D"m_-7574783336619094805pun"><br>Make C++ mor=
e sweet!</span></code></pre></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/8cde95ae-23fe-442f-9bf2-5c040f05efde%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8cde95ae-23fe-442f-9bf2-5c040f05efde=
%40isocpp.org</a>.<br />

------=_Part_1335_740211968.1488787069628--

------=_Part_1334_461285828.1488787069628--

.
