220 26381 <2308f718-9fcb-445f-974c-9acc9c0aa605@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: template<auto&>
Date: Sat, 25 Jun 2016 10:56:43 -0700 (PDT)
Lines: 118
Approved: news@gmane.org
Message-ID: <2308f718-9fcb-445f-974c-9acc9c0aa605@isocpp.org>
References: <58413fd1-653d-4171-a250-baa99c0a597b@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_205_1149690343.1466877403771"
X-Trace: ger.gmane.org 1466877417 15475 80.91.229.3 (25 Jun 2016 17:56:57 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 25 Jun 2016 17:56:57 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBXMLXO5QKGQE7NQXXAY@isocpp.org Sat Jun 25 19:56:52 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBBXMLXO5QKGQE7NQXXAY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f197.google.com ([209.85.223.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBXMLXO5QKGQE7NQXXAY@isocpp.org>)
	id 1bGrp1-0000lD-C5
	for gclcip-std-proposals@m.gmane.org; Sat, 25 Jun 2016 19:56:47 +0200
Original-Received: by mail-io0-f197.google.com with SMTP id x68sf281868663ioi.0
        for <gclcip-std-proposals@m.gmane.org>; Sat, 25 Jun 2016 10:56:46 -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=yCuCC9yBT50CwoLk0IcfFsLEQvJA8ckgJujw+XRTPQ8=;
        b=J6cxv2QjQbPTLlNIowahRIZbpnpFk7yNp/aLG74oRfC1zzg+Lc8p+9+4UJ82v9gM+g
         LJnw/K6Jm3xsT/0EQd7AsN+K5AjSkAPh1mSNqBA+53aJCJRtX6l/ZJHyo0/esq7++oN7
         ZzFaFY8+bpnQ8t0vtgVWHzc0c4ZRXhhyIEWfaOd56XlLlDfaTg9vCaZqcixWJUS6q/nb
         38vPkQ8V/S6/ZrVejLMhgKk3YFBGIGoGJ7uUkx2zyZfyC5t7T5fw5UoJ1DIqHs9dUoZD
         VDVIpFu5K0e+4C5HNSX2V2nrH6GyuzzK/FYtSpgDZsHnpuRZrV5uyPglMi4I74slkmUz
         5vDA==
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=yCuCC9yBT50CwoLk0IcfFsLEQvJA8ckgJujw+XRTPQ8=;
        b=TKv5S/uq72iL3ZwIZVazxLUVMvyh+0bzii753XYrfdmVhZ9SQFNsJ0E8ycn8bHXCio
         o8ND27UCmsVKKkzv/lsn5plU0X1tkxV3jNSkzGFRHaH6FBc0LS+M4cWJ5N/SxZ6ETcSa
         EHgy22jNKa7HUa+4lho7UbOq41D4zYqhDz+sSko+l2qKCN/zOo+5s+QjzYSd9YdqHdRT
         KyditYmGwKLALuNI5O9/0iZ+TpoELgiLjclbM4gwF8xYo6DH4YggIeLesXYDZaFBYz9R
         sRfE1uWfj1myQXDmU6F1rR9awkNRe905WRaU/aLJObp6YxLny3cN4iYC76DofPzNBz2e
         arDg==
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=yCuCC9yBT50CwoLk0IcfFsLEQvJA8ckgJujw+XRTPQ8=;
        b=E6wz1EbYVbR+WLQdZr3cTo9+YUsHrdGtxia4pqvh7pNiBXRCQAYzhb92qMWJm7pRtY
         VOYM0/i+7VlCDa/JLOm2UYpMjjYV/JGl0IO2yMuv4AUExj9TjY06ll+mHUqJw+00vBGx
         vIiyqLZ7uiQCBX3Y959TKkTE9oF2Ue3a/QQTvQgQ3hQ/GwH9kk/aUus0TZi7Nn5zZGOk
         4hLiIUk0groFkhaTFu5c3qlg/yFcqr/VtJIoEOo78H2G23HxZUuRNcI6UVcPlkNPGHBk
         v9lgphde5/HLowmeKUmOxSJXTlbPQ2setSDMD8o/DHps1z2nJ+J2lq/Vy98bcuNDT5M7
         r3lQ==
X-Gm-Message-State: ALyK8tIhlHbvHXDldW6lTAZl7z/DM5EJ6JTJRWu2oap2yBFGWXsiO6nNIje09O+B9QAT/w==
X-Received: by 10.36.73.170 with SMTP id e42mr3926492itd.4.1466877406027;
        Sat, 25 Jun 2016 10:56:46 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.129.6 with SMTP id q6ls554286itd.44.gmail; Sat, 25 Jun 2016
 10:56:45 -0700 (PDT)
X-Received: by 10.36.17.15 with SMTP id 15mr113943itf.10.1466877405019;
        Sat, 25 Jun 2016 10:56:45 -0700 (PDT)
In-Reply-To: <58413fd1-653d-4171-a250-baa99c0a597b@isocpp.org>
X-Original-Sender: jmckesson@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:26381
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26381>

------=_Part_205_1149690343.1466877403771
Content-Type: multipart/alternative; 
	boundary="----=_Part_206_1122936876.1466877403772"

------=_Part_206_1122936876.1466877403772
Content-Type: text/plain; charset=UTF-8

On Saturday, June 25, 2016 at 12:14:28 PM UTC-4, Guillaume Racicot wrote:
>
> After reading P0127R1 
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0127r1.html>, I 
> wondered if auto& as a template parameter is be possible too. It would 
> 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 
parameters based on the value passed. It does not change what valid 
non-type template parameters can be.

You couldn't do `template<int &i>`  before, so you can't do it now. You can 
make it a pointer if you want, but that would require doing `Foo<*i>`.

-- 
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/2308f718-9fcb-445f-974c-9acc9c0aa605%40isocpp.org.

------=_Part_206_1122936876.1466877403772
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<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" target=3D"_blank" rel=3D"nofollow" onmousedown=
=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-s=
td.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0127r1.html\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNEYB71CqkjHlBm03Vs5JBamsn2y6A&#39;;return tru=
e;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2=
Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0127r1.htm=
l\x26sa\x3dD\x26sntz\x3d1\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 st=
yle=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-co=
lor:rgb(250,250,250)"><code><div><span style=3D"color:#008">template</span>=
<span style=3D"color:#660">&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"color:#660">&gt;</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#008">struct</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#606">Foo</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 </span><span style=3D"color:#008">void</span><span style=3D"color:#=
000"> display</span><span style=3D"color:#660">()</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:#00=
0"><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 style=3D"color:#000"> </span><span style=3D"color:#080">&=
quot;value: &quot;</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">&lt;&lt;</span><span style=3D"color:#000"> thing </span><span s=
tyle=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:#00=
0"> </span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#=
000"> </span><span style=3D"color:#660">&amp;</span><span style=3D"color:#0=
00">thing </span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"c=
olor:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"co=
lor:#000">endl</span><span style=3D"color:#660">;</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span s=
tyle=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span st=
yle=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><spa=
n style=3D"color:#000"> i</span><span style=3D"color:#660">;</span><span st=
yle=3D"color:#000"><br><br></span><span style=3D"color:#606">Foo</span><spa=
n style=3D"color:#080">&lt;i&gt;</span><span style=3D"color:#000"> foo</spa=
n><span style=3D"color:#660">;</span></div></code></div><div><br></div><div=
>Is this thing already possible in the current proposal?</div></div></block=
quote><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 vali=
d 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. You can make =
it a pointer if you want, but that would require doing `Foo&lt;*i&gt;`.<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/2308f718-9fcb-445f-974c-9acc9c0aa605%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2308f718-9fcb-445f-974c-9acc9c0aa605=
%40isocpp.org</a>.<br />

------=_Part_206_1122936876.1466877403772--

------=_Part_205_1149690343.1466877403771--

.
