220 32116 <a163f3bd-906e-4dc4-894b-0aae6d2b2e89@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Jakob Riedle <jakob.riedle@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allow constexpr static data members in a literal type.
Date: Wed, 19 Apr 2017 05:58:54 -0700 (PDT)
Lines: 84
Approved: news@gmane.org
Message-ID: <a163f3bd-906e-4dc4-894b-0aae6d2b2e89@isocpp.org>
References: <dfb9f65c-ea1d-e92b-85e0-333efed1aec5@scylladb.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_7264_1583466568.1492606734756"
X-Trace: blaine.gmane.org 1492606738 28375 195.159.176.226 (19 Apr 2017 12:58:58 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 19 Apr 2017 12:58:58 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCX2XNFO6MPRBD563XDQKGQE4UG4PGQ@isocpp.org Wed Apr 19 14:58:51 2017
Return-path: <std-proposals+bncBCX2XNFO6MPRBD563XDQKGQE4UG4PGQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f69.google.com ([209.85.214.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCX2XNFO6MPRBD563XDQKGQE4UG4PGQ@isocpp.org>)
	id 1d0pC6-0007E2-Qh
	for gclcip-std-proposals@m.gmane.org; Wed, 19 Apr 2017 14:58:51 +0200
Original-Received: by mail-it0-f69.google.com with SMTP id 67sf9817386ite.6
        for <gclcip-std-proposals@m.gmane.org>; Wed, 19 Apr 2017 05:58:56 -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=UQZdExyJnBIjj8sXRPTiHYle4ONHFGJw/7xKgq53dB4=;
        b=Q17ZF8GKr3zD4DX4mcaXO6FHiYK4lt4oTbgLECcWH8Nz0wbdW0qTYJYRE568Acr/LM
         BwyOtmVN5Db2pZJzofT65IjSJV15kJAVv08ZIzX4EO2tct7UswnKZ/ZPnUKMCxhWcIYz
         sYp5H+wWFtSEI21PUntAOy8nIxfeEIZxU/6JSbqSLsxtY+/EAzEyUI4JG9E7PC1INB59
         sskoLBRDYRqYsGR4v2kXRlkv6RxQs1/JuE5Q1Z8S5kyDQIHV9lpu6Xb1NdPIo4Ry5NRn
         1AmqqFvFR5cQMsxcR7n/QIXroUFne/wfAF7ss2TXJhvL/mDRthIks7YQt8vHqOryesvy
         pVcA==
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
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=UQZdExyJnBIjj8sXRPTiHYle4ONHFGJw/7xKgq53dB4=;
        b=utKeaSJfmPuZE0hSTeF3d2/sV6zaLnKuvdUDQiipCrAzEFdVLoOgld4vMqBV7APBQI
         rIAkcuqhLbUGCHxK4o+tTxyrEekE/WRp5MlfmXhG3UgYik2iAeRXfcP97BAvIDZ/fkb2
         JkzLDI4alJlDITOs+aM9O1IYdkYEifOFZxO1VJJ5Fhc/2bU0YnCR4eJlBGv3vXAjgKY3
         A24KS1dRcBQHhCFSqQVbadP7rWAwS1jBXADCGAxTDCq83+8Ry6/psKnC4ZmvIOMMKdxj
         pbfosdIo4PnYtd/MzPVuToTwzU3JxPoURPAyGzWFp9dAQTi8qL5FqH36wW5xLGJfF20q
         ZrQA==
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=UQZdExyJnBIjj8sXRPTiHYle4ONHFGJw/7xKgq53dB4=;
        b=hIzb0E9Il1NivuiYzCZKVpHzgXNTKBwupZ/uMddxfp7HmfXPEAZTdkmP70y8lyE1DF
         5u9NnFlfXjznr95OoZJTq58Rwp468cZ2RUOpfJEedzQiNGsqZDkPRNZTHDQwcZbNFZ3J
         AYN2daw/0xzXsi08DNEVVbkXH0Vsb/okF4CtmDe0cjA2TzmlvBl9wCT6JNvGyPFesM6S
         I0K9Z3GMwfmFrdr6Rpb2Tz4l9BIZc2gZqwVWxEk5W7XmJMyrDu8xF4HLQsc4Vlm7yx9N
         UroLNquvmGlvzvmJrTu+e2lWgX366/APOiUHb+7Aye3QDQI1Mid5AFVY0MEaCBrAZ9Rp
         7T+w==
X-Gm-Message-State: AN3rC/49NIPOvn5umIUEGQ0MWA38bahkG4Eoo1LdNAzWEu4PoniT8HoD
	TopbCr7ptsJYvA==
X-Received: by 10.107.140.198 with SMTP id o189mr1307893iod.60.1492606736384;
        Wed, 19 Apr 2017 05:58:56 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.19.72 with SMTP id q8ls3017744otq.23.gmail; Wed, 19 Apr
 2017 05:58:55 -0700 (PDT)
X-Received: by 10.157.26.98 with SMTP id u31mr61105otu.0.1492606735300;
        Wed, 19 Apr 2017 05:58:55 -0700 (PDT)
In-Reply-To: <dfb9f65c-ea1d-e92b-85e0-333efed1aec5@scylladb.com>
X-Original-Sender: jakob.riedle@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:32116
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32116>

------=_Part_7264_1583466568.1492606734756
Content-Type: multipart/alternative; 
	boundary="----=_Part_7265_463703066.1492606734756"

------=_Part_7265_463703066.1492606734756
Content-Type: text/plain; charset=UTF-8


>
> Should we make this legal?  It seems reasonable for types to offer 
> constants scoped under their own name, and if they are literal types, 
> that these constants can be constexpr. 
>

I really like the idea of being able to do that and I had that scenario 
quite often,
e.g. with a Color-Class that defines several constants, such as WHITE, 
BLACK ...
The problem with defining the attributes outside the class,
is that you cannot declare this stuff in a header file and include it 
multiple times.

However, this problem is solved by Inline Variables 
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4424.pdf>.
Still, having to define *constexpr static *class variables outside of the 
class is *neither pretty nor intuitive*.

*Note*: *Java supports this feature for a long time already.*
*M(atlab) also supports this. (Using a section named "enumeration" within 
the "classdef" itself).*

Given these reasons, I'm greatly convinced, this is a good thing and should 
be written a paper for.

-- 
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/a163f3bd-906e-4dc4-894b-0aae6d2b2e89%40isocpp.org.

------=_Part_7265_463703066.1492606734756
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Should we mak=
e this legal? =C2=A0It seems reasonable for types to offer=C2=A0<br>constan=
ts scoped under their own name, and if they are literal types,=C2=A0<br>tha=
t these constants can be constexpr.=C2=A0<br></blockquote><div><br></div><d=
iv>I really like the idea of being able to do that and I had that scenario =
quite often,</div><div>e.g. with a Color-Class that defines several constan=
ts, such as WHITE, BLACK ...</div><div>The problem with defining the attrib=
utes outside the class,</div><div>is that you cannot declare this stuff in =
a header file and include it multiple times.</div><div><br></div><div>Howev=
er, this problem is solved by=C2=A0<a href=3D"http://www.open-std.org/jtc1/=
sc22/wg21/docs/papers/2015/n4424.pdf">Inline Variables</a>.</div><div>Still=
, having to define <i>constexpr static=C2=A0</i>class variables outside of =
the class is <b>neither pretty nor intuitive</b>.</div><div><br></div><div>=
<b>Note</b>: <i>Java supports this feature for a long time already.</i></di=
v><div><i>M(atlab) also supports this. (Using a section named &quot;enumera=
tion&quot; within the &quot;classdef&quot; itself).</i></div><div><br></div=
><div>Given these reasons, I&#39;m greatly convinced, this is a good thing =
and should be written a paper for.</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/a163f3bd-906e-4dc4-894b-0aae6d2b2e89%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a163f3bd-906e-4dc4-894b-0aae6d2b2e89=
%40isocpp.org</a>.<br />

------=_Part_7265_463703066.1492606734756--

------=_Part_7264_1583466568.1492606734756--

.
