220 26385 <e52a753b-cbe9-4ff0-b783-ffe4ffffb384@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: "S.B." <i.and.my.little.friends@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: template<auto&>
Date: Sat, 25 Jun 2016 11:25:38 -0700 (PDT)
Lines: 157
Approved: news@gmane.org
Message-ID: <e52a753b-cbe9-4ff0-b783-ffe4ffffb384@isocpp.org>
References: <58413fd1-653d-4171-a250-baa99c0a597b@isocpp.org>
 <2308f718-9fcb-445f-974c-9acc9c0aa605@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3120_42272680.1466879138899"
X-Trace: ger.gmane.org 1466879149 7784 80.91.229.3 (25 Jun 2016 18:25:49 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 25 Jun 2016 18:25:49 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLPV3M6UAHBBI4ZXO5QKGQEWW4JDUI@isocpp.org Sat Jun 25 20:25:42 2016
Return-path: <std-proposals+bncBDLPV3M6UAHBBI4ZXO5QKGQEWW4JDUI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f200.google.com ([209.85.161.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDLPV3M6UAHBBI4ZXO5QKGQEWW4JDUI@isocpp.org>)
	id 1bGsGz-00082A-Am
	for gclcip-std-proposals@m.gmane.org; Sat, 25 Jun 2016 20:25:41 +0200
Original-Received: by mail-yw0-f200.google.com with SMTP id v77sf309019190ywg.1
        for <gclcip-std-proposals@m.gmane.org>; Sat, 25 Jun 2016 11:25:41 -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=RBpE55BXbmVq5TpSnMarXaQj+SbgZBtz6h4fjPXDwOA=;
        b=uO0/X/bIMj3jt1QgS5mvVQ2ZA6HhRdi9vbJ/oxXlKDdAlfRh8Zk7Vavz9kEJj1gwQ7
         6V3tbYpOjcDi/T7tJwW2219bzxggQV4ocWb865LJ/5K3mY3EY0rnZwnGOXDN54CIzpSH
         I8nptog7Zq67zfgEUA37+h2Wd7PZhwM5zfrQqwmUW/kfToQVSC3M0scFMkhsD9PWrhqZ
         DiMVenofS6BWzpanDq4jZZ49TrckSKpVuNJjKefNhR3YFXe+Qx7fAIfMfSXMI2ZRDeCi
         vq3Vsnx4wyhCUkdn5/gfbUyG1qIKbbDW7CD+vx619HkM0utYcNXLYOo9Tghnfj6KFYpY
         ubBA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        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=RBpE55BXbmVq5TpSnMarXaQj+SbgZBtz6h4fjPXDwOA=;
        b=c8knIhBQEgzflezdffwxcQQqXvl1sSvcX9x4V4T06AqNGpG7wGOGuZxAI0f7Ctp8O5
         OT87HFiSNghyNmK4urTMRYOHwJ6mM6UV1goJEC92/z1m5JkoSKMc3Q+YwL2e71IfqUMo
         chDGcdi3bOA8G5wOgFZvhpTjpFGQp3mc77uUPqSq19YtIb8ePTFClpDX8K8j0bW/PPl2
         D3qqriZH5jVQCFM4HajzRJCLtL0cZR1ZepadYgH0uFYrvjkWtHcYgU4NR39gAJowKaDh
         I4RkdJSWG3IOJDcW1roMyupR3R7UpObliJ/YlZRwIyd5bHzVsEZuzdvVRRNGw8j4rwpk
         Ftrg==
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: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=RBpE55BXbmVq5TpSnMarXaQj+SbgZBtz6h4fjPXDwOA=;
        b=OrnqbMxvFQSJK4Kt60LSl1jv2p3Ay6pkJf/kUFBCwn/Rv35b2xW2wsmEpTWnceXgk/
         U0OJ/tOgElOdS3NbaE4ycYi4B8Q1/OqHUsKi5G+STpE8J7Ywahs31sVhq1pt8eVu2qaI
         tD6uRlAmA0ZiK0SUA9mlU0g/IUSeNVtkF1qeuA5jQpLLHjCP59D7o8Ypm7lvI632n1rc
         wJg5pcJaOJLLjoqVg8l6SqZVUJrro2uP1U/4ze2o0aufnrhlJT7/ssQqa686WHkTK7tU
         VKx9Uu/aWkufKwirUYpdZkfVsH0e6K+c5/gcWUda1mnO09eUA7ugvhBWbBHGbRLigIEc
         THXg==
X-Gm-Message-State: ALyK8tKpqsPxueRMAigXyd8PKBy3kVZiFy/iFCjtg1bpAHAQH3WcMaHwI1oR0oIpviy7fw==
X-Received: by 10.31.172.10 with SMTP id v10mr9508082vke.14.1466879140498;
        Sat, 25 Jun 2016 11:25:40 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.57.87 with SMTP id l84ls86717ita.39.gmail; Sat, 25 Jun 2016
 11:25:39 -0700 (PDT)
X-Received: by 10.36.124.143 with SMTP id a137mr114913itd.9.1466879139428;
        Sat, 25 Jun 2016 11:25:39 -0700 (PDT)
In-Reply-To: <2308f718-9fcb-445f-974c-9acc9c0aa605@isocpp.org>
X-Original-Sender: I.and.my.little.friends@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:26385
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26385>

------=_Part_3120_42272680.1466879138899
Content-Type: multipart/alternative; 
	boundary="----=_Part_3121_2079464929.1466879138900"

------=_Part_3121_2079464929.1466879138900
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Sunday, June 26, 2016 at 1:56:44 AM UTC+8, Nicol Bolas wrote:
>
> On Saturday, June 25, 2016 at 12:14:28 PM UTC-4, Guillaume Racicot wrote:
>>
>> After reading P0127R1=20
>> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0127r1.html>,=
=20
>> I wondered if auto& as a template parameter is be possible too. It would=
=20
>> allow things like this:
>>
>> template<auto& thing>
>> struct Foo {
>>     void display() {
>>         std::cout << "value: " << thing << " address: " << &thing << std
>> ::endl;
>>     }
>> };
>>
>> extern int i;
>>
>> Foo<i> foo;
>>
>> Is this thing already possible in the current proposal?
>>
>
> No. The paper merely adds deduction of the type of non-type template=20
> parameters based on the value passed. It does not change what valid=20
> non-type template parameters can be.
>
> You couldn't do `template<int &i>`  before, so you can't do it now.=20
>

We *could *do `template<int &i>` before.

N4594 =C2=A7 14.1[temp.param]p4
4 A non-type template-parameter shall have one of the following (optionally=
=20
cv-quali=EF=AC=81ed) types:
=E2=80=94 (4.1) integral or enumeration type,
=E2=80=94 (4.2) pointer to object or pointer to function,
*=E2=80=94 (4.3) lvalue reference to object or lvalue reference to function=
,*
=E2=80=94 (4.4) pointer to member,
=E2=80=94 (4.5) std::nullptr_t.

> You can make it a pointer if you want, but that would require doing=20
> `Foo<*i>`.
>

--=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/e52a753b-cbe9-4ff0-b783-ffe4ffffb384%40isocpp.or=
g.

------=_Part_3121_2079464929.1466879138900
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Sunday, June 26, 2016 at 1:56:44 AM UTC+8, Nico=
l Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
>On Saturday, June 25, 2016 at 12:14:28 PM UTC-4, Guillaume Racicot 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"ltr">After reading=C2=A0=
<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0127r1.=
html" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39;ht=
tp://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2F=
wg21%2Fdocs%2Fpapers%2F2016%2Fp0127r1.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNEYB71CqkjHlBm03Vs5JBamsn2y6A&#39;;return true;" onclick=3D"this.hre=
f=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc=
1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0127r1.html\x26sa\x3dD\x26sntz\x3=
d1\x26usg\x3dAFQjCNEYB71CqkjHlBm03Vs5JBamsn2y6A&#39;;return true;">P0127R1<=
/a>, I wondered if auto&amp; as a template parameter is be possible too. It=
 would allow things like this:<div><br></div><div style=3D"border:1px solid=
 rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><=
code><div><span style=3D"color:#008">template</span><span style=3D"color:#6=
60">&lt;</span><span style=3D"color:#008">auto</span><span style=3D"color:#=
660">&amp;</span><span style=3D"color:#000"> thing</span><span style=3D"col=
or:#660">&gt;</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#008">struct</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#606">Foo</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:#008">void</span><span style=3D"color:#000"> display</span><sp=
an style=3D"color:#660">()</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=3D"=
color:#000">cout </span><span style=3D"color:#660">&lt;&lt;</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#080">&quot;value: &quot;</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">&lt;&lt;<=
/span><span style=3D"color:#000"> thing </span><span style=3D"color:#660">&=
lt;&lt;</span><span style=3D"color:#000"> </span><span style=3D"color:#080"=
>&quot; address: &quot;</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#660">&amp;</span><span style=3D"color:#000">thing </span><spa=
n style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> std</span=
><span style=3D"color:#660">::</span><span style=3D"color:#000">endl</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#000"=
><br></span><span style=3D"color:#660">};</span><span style=3D"color:#000">=
<br><br></span><span style=3D"color:#008">extern</span><span style=3D"color=
:#000"> </span><span style=3D"color:#008">int</span><span style=3D"color:#0=
00"> i</span><span style=3D"color:#660">;</span><span style=3D"color:#000">=
<br><br></span><span style=3D"color:#606">Foo</span><span style=3D"color:#0=
80">&lt;i&gt;</span><span style=3D"color:#000"> foo</span><span style=3D"co=
lor:#660">;</span></div></code></div><div><br></div><div>Is this thing alre=
ady possible in the current proposal?</div></div></blockquote><div><br>No. =
The paper merely adds deduction of the type of non-type template parameters=
 based on the value passed. It does not change what valid non-type template=
 parameters can be.<br><br>You couldn&#39;t do `template&lt;int &amp;i&gt;`=
=C2=A0 before, so you can&#39;t do it now. </div></div></blockquote><div><b=
r>We <b>could </b>do `template&lt;int &amp;i&gt;` before.<br><br>N4594 =C2=
=A7 14.1[temp.param]p4<br>4 A non-type template-parameter shall have one of=
 the following (optionally cv-quali=EF=AC=81ed) types:<br>=E2=80=94 (4.1) i=
ntegral or enumeration type,<br>=E2=80=94 (4.2) pointer to object or pointe=
r to function,<br><b>=E2=80=94 (4.3) lvalue reference to object or lvalue r=
eference to function,</b><br>=E2=80=94 (4.4) pointer to member,<br>=E2=80=
=94 (4.5) std::nullptr_t.<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><div dir=3D"ltr"><div>You can make it a pointer if you want, but that=
 would require doing `Foo&lt;*i&gt;`.<br></div></div></blockquote></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/e52a753b-cbe9-4ff0-b783-ffe4ffffb384%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e52a753b-cbe9-4ff0-b783-ffe4ffffb384=
%40isocpp.org</a>.<br />

------=_Part_3121_2079464929.1466879138900--

------=_Part_3120_42272680.1466879138899--

.
