220 27720 <b802b9e3-9f14-4b93-afb5-47b5dc5034a1@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Cleiton Santoia <cleitonsantoia@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: if constexpr in class declaration
Date: Tue, 9 Aug 2016 10:30:47 -0700 (PDT)
Lines: 119
Approved: news@gmane.org
Message-ID: <b802b9e3-9f14-4b93-afb5-47b5dc5034a1@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_365_1335599945.1470763847662"
X-Trace: blaine.gmane.org 1470763855 24987 195.159.176.226 (9 Aug 2016 17:30:55 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 9 Aug 2016 17:30:55 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCBMVWMTUUNBBSFGVC6QKGQEBUTDY5Q@isocpp.org Tue Aug 09 19:30:51 2016
Return-path: <std-proposals+bncBCBMVWMTUUNBBSFGVC6QKGQEBUTDY5Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f71.google.com ([209.85.220.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCBMVWMTUUNBBSFGVC6QKGQEBUTDY5Q@isocpp.org>)
	id 1bXArZ-0006LP-MS
	for gclcip-std-proposals@m.gmane.org; Tue, 09 Aug 2016 19:30:50 +0200
Original-Received: by mail-pa0-f71.google.com with SMTP id pp5sf32861133pac.3
        for <gclcip-std-proposals@m.gmane.org>; Tue, 09 Aug 2016 10:30:50 -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: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=EDj4V8vgCMKUBkaidiYnmeeGmC3XiT7nrGh9kCuox4Q=;
        b=KGXinBgjRNErh1hsRkEiQ8ZjJrfL6z0qBhxcoYEdoGb7ndgWOorhg571foKWLqvpqt
         xWW20DKB2EJqEIwiVq1DMKCpKb76gthovIBJ6dWDvG2rTD3rZ71E8CEqKcyHV/oX4+Mw
         9TvD51M9uHuntV+3poOVFRaxSjCU2Y1GshlMOYwkZc418No1h+vDgo1WgEM1GYAu0hVm
         uWhhCFlNDvd19gkdT/H970XBW9AFehp7Nl83K3PzfZ8sb38pRjp0v+Y+uy/5z2+moHGS
         Ds158zy2SiDdl856q5ZlshqFaR+NhBX/c154UjcjvfcJ5lBwYys1m9DwDvj8r6o1Zpl2
         6Asg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        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=EDj4V8vgCMKUBkaidiYnmeeGmC3XiT7nrGh9kCuox4Q=;
        b=kM6hri7ms3IXTV65V1oEkEd1z4Gq/yC2MogKUB80i04OCz9LojrAosXK7VGnD0GRZY
         xncUTfDQHtGPLG5yevt2aBiQwXlxaBPPo85szdek115Mf3WeTREH6A+dTgyDObT3us2c
         ptTYF7z7u881XU2Kp6NkJYee16G0HLvklHIcGqsY2ZiYP76WBN0XpKwNDjKdyhcelouL
         8m2o7ao1irWMA7x4utP1P+Uy+9pG6InQsGpi3P/Lry7aKvc51NwMlsm4n4z71WfJHL/m
         7W5AGFy61yD20OHarvBacXyA1Gb3KNSqUWC08ilcdbYNqrstrAhraWEOsmrx0zOpaFy/
         FpDg==
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: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=EDj4V8vgCMKUBkaidiYnmeeGmC3XiT7nrGh9kCuox4Q=;
        b=LenC0TdC/OTWoD/ZQYNUAJJRvPsNa91aZO3nnsOe8dnLHLlLg+7LPw/dvw0wzKGNN2
         AgYxIQq5eHfH67y59uycFS0gW3CcFvfdSLlF4GOAsOQGl/5lYZj/wTo4a35lEjVe5s6r
         KbCX3FLDtlFw7i1cxMgo8WCnoV151+UMF2sXvUjJF+D6PBBg7kRo7EaZmU/Ih3IyQzkC
         ZfxcGe5H7trmx7nft7HdPVNa9WF9COpz0KOzqcnxO5GW4L05r3GSY0TVRlnJyfplAgsE
         Abh19cMOo3bpxmz1ApfwUfEnBnVSiq4pV7rhjlfBrwE9lODayRLVsz+Sqq4RRjWx4AOl
         o9EQ==
X-Gm-Message-State: AEkoousJFft1cYTjPplJgzWOobaTpA447dcYbSjumpELpYC0I5+oBvedMF1mP7+BnFfF3g==
X-Received: by 10.98.78.203 with SMTP id c194mr84128338pfb.3.1470763849565;
        Tue, 09 Aug 2016 10:30:49 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.82.81 with SMTP id d78ls5794773itb.17.gmail; Tue, 09 Aug
 2016 10:30:48 -0700 (PDT)
X-Received: by 10.36.230.194 with SMTP id e185mr808562ith.9.1470763848317;
        Tue, 09 Aug 2016 10:30:48 -0700 (PDT)
X-Original-Sender: cleitonsantoia@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:27720
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/27720>

------=_Part_365_1335599945.1470763847662
Content-Type: multipart/alternative; 
	boundary="----=_Part_366_873861596.1470763847663"

------=_Part_366_873861596.1470763847663
Content-Type: text/plain; charset=UTF-8

"If constexpr" is defined only as statement, someone thought about allow it 
into class definitions like this :

template <class T>
struct X {
   if constexpr (std::is_arithmetic_v<T>) {
     double value;
   } else constexpr {
     std::string value;
   }
};

X<int>::value     // value is double
X<Myclass>::value // value is string

I know that this particular example will be better with concepts, but the 
question remains... 


-- 
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/b802b9e3-9f14-4b93-afb5-47b5dc5034a1%40isocpp.org.

------=_Part_366_873861596.1470763847663
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>&quot;If constexpr&quot; is defined only as statement=
, someone thought about allow it into class definitions like this :</div><d=
iv><br></div><div><div class=3D"prettyprint" style=3D"border: 1px solid rgb=
(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250=
);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> X </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0</span><span style=3D"color: #008;" class=3D"styled-by-prettify">if</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(</span><font color=3D"#000088"=
><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">is_arithmetic_v</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">T</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&gt;)</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">double</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> value</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span></font><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">=C2=A0 =C2=A0</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">else</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0std</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">string</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> value</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br>X</span><span style=3D"color: #080;" class=3D"styled-by-=
prettify">&lt;int&gt;</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">value =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-=
by-prettify">// value is double</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>X</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Myclass</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">value </span><span style=3D"color: #800;" class=3D"styled-by-prettify">/=
/ value is string</span></div></code></div><br>I know that this particular =
example will be better with concepts, but the question remains...=C2=A0</di=
v><div><br></div><div><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/b802b9e3-9f14-4b93-afb5-47b5dc5034a1%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b802b9e3-9f14-4b93-afb5-47b5dc5034a1=
%40isocpp.org</a>.<br />

------=_Part_366_873861596.1470763847663--

------=_Part_365_1335599945.1470763847662--

.
