220 26328 <71f9f321-59e4-452e-84d1-74d2c476c2de@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: inkwizytoryankes@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: statement folding on variadic templates
 parameters pack
Date: Mon, 13 Jun 2016 16:18:24 -0700 (PDT)
Lines: 368
Approved: news@gmane.org
Message-ID: <71f9f321-59e4-452e-84d1-74d2c476c2de@isocpp.org>
References: <1e3daa7c-e10a-4589-8118-26f47bc1a0df@isocpp.org>
 <f11d3266-3407-4c00-a578-5d07beeb1071@isocpp.org>
 <b967b669-6c28-4295-b5c8-6a2f2ed7a174@isocpp.org>
 <9c425e18-e592-4cfd-9e41-b37b212a6b9d@isocpp.org>
 <1015518c-c0e4-4397-b946-df7834a2c3c0@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1127_1727022655.1465859904296"
X-Trace: ger.gmane.org 1465859909 531 80.91.229.3 (13 Jun 2016 23:18:29 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 13 Jun 2016 23:18:29 +0000 (UTC)
Cc: inkwizytoryankes@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDDLTAGNTIBBBQP67S5AKGQEW3CL72A@isocpp.org Tue Jun 14 01:18:28 2016
Return-path: <std-proposals+bncBDDLTAGNTIBBBQP67S5AKGQEW3CL72A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f197.google.com ([209.85.220.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDDLTAGNTIBBBQP67S5AKGQEW3CL72A@isocpp.org>)
	id 1bCb7j-0008EX-MP
	for gclcip-std-proposals@m.gmane.org; Tue, 14 Jun 2016 01:18:28 +0200
Original-Received: by mail-qk0-f197.google.com with SMTP id d2sf220298347qkg.1
        for <gclcip-std-proposals@m.gmane.org>; Mon, 13 Jun 2016 16:18:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc: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=BnZRA9hMJEqxlcFYFYk8u5fdlEGMG9heG7ILkD5zcyY=;
        b=giarZHnpkgMYHMKtjQDkvlK/T19tojDOpt3ZCLXubwdRyf6Nf1UzvckKnd5yPr05M8
         Ec9udUUVxLMetpmVm8ugqUEzZPKtajVG+1z28B8E4X12hk54KyyKPFxtLnzsd5Q8jfWP
         0Lzhi6UyZqFXY17NzcF4svCNIQTyIBBhyVSTcK5nGlwHsiaZ9wpv+0JwQcJs1+2PJCWx
         L/3Tky0c35QA1ALTIzawmCe8PVEYROomjg0WJt7jI/0CduMZHo1FYwOwhIN6c1sYmYky
         tFSElpSKFsPaEqNHgSHl2Hu9grnArGxWGD6iNhcwa5TL35xSTo4bhi4X3RvWV17zprcA
         qC5w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc: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=BnZRA9hMJEqxlcFYFYk8u5fdlEGMG9heG7ILkD5zcyY=;
        b=CGwjQU6jEhG9foq17/ADO11awjEmvL6OqVuX0H+ic+CKkec6xdveBCPew9iqwJTpQ1
         qjArfjpf9DtZFR8xJlOE+sXZqAbqHEp7I2MdZrvBHOdaZwJRW3+KI3EiR2h2WaNxIlIR
         tRX7KKbKfGGQp27FEQCVIai80R+6/MUb8+5FCmwN7UWG+aqdP5Z7JHrR8SeIZ7OK0RvG
         V/DymFZrazZirHHQ84r3MUkZsUe6W1iQT1GldqkfJj0uKiabwUJD5EuN1WCHa/pXYjpv
         7+x00t6cFlITh09TGdisnpHR9hqh42cvjq//hIPX8wCleKRihgg7kdCLd3VvUJRoYPK8
         B4jQ==
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:cc: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=BnZRA9hMJEqxlcFYFYk8u5fdlEGMG9heG7ILkD5zcyY=;
        b=me3VtjYZt2aLY/Ahr7TpflymRSU+WSvToOOYZe9yw4kN8gq9zwd3BiDvSW0wGm2fWA
         JPj0UCKjQf4zyyoIWy3LcLgs5kgSSHFDerIIA1GqtE4kubRinusBwvqj3pqtqYpknO+U
         kEwe3FS6zFo/4K+cCrsCjopG0gfeuBRKsgrQH8d1CBflDMnLW8+pNMu6Blg2NYq/5ojk
         Pnjir7J7gkOiK5ZFtum8XjEFqH6dw9Uod0M8HtWIuYj2uCtumCVB8Kqyrbus1B+lbqD4
         k4bK/WmCWHUFTVyT0eQw0/QCuI3Hn6d2yA9vf1fRWljrWPD5bygYNwicTTAkYZwCfl8n
         vCEg==
X-Gm-Message-State: ALyK8tLzJxwWwaI8uX3c2g0vgeTWOh2Gpyl/LTAkHJEG6XmtYvwyP9L2415jqyOKjm3OeQ==
X-Received: by 10.13.225.204 with SMTP id k195mr7886053ywe.46.1465859906765;
        Mon, 13 Jun 2016 16:18:26 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.245.2 with SMTP id k2ls1048994ith.39.canary; Mon, 13 Jun
 2016 16:18:25 -0700 (PDT)
X-Received: by 10.36.213.134 with SMTP id a128mr322539itg.8.1465859905637;
        Mon, 13 Jun 2016 16:18:25 -0700 (PDT)
In-Reply-To: <1015518c-c0e4-4397-b946-df7834a2c3c0@isocpp.org>
X-Original-Sender: inkwizytoryankes@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:26328
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26328>

------=_Part_1127_1727022655.1465859904296
Content-Type: multipart/alternative; 
	boundary="----=_Part_1128_1958846099.1465859904297"

------=_Part_1128_1958846099.1465859904297
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Monday, June 13, 2016 at 7:56:48 PM UTC+2, Sergey Vidyuk wrote:
>
> =D1=81=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0, 11 =D0=B8=D1=8E=D0=BD=D1=8F 2=
016 =D0=B3., 1:10:04 UTC+6 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C inkwizyt...@gmail.com=20
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>>  I think that `for constexpr` should be allowed to extracting parameters=
=20
>> from templates, some thing like that:
>> using type =3D std::tuple<int, long long, char>;
>>
>> int main()
>> {
>>     for constexpr (typename T : type) //without `...`
>>     {
>>         f<T>();
>>     } //equal: `f<int>(); f<long long>(); f<char>();`
>> }
>>
>>
> Am I right tha the main and only reason you would like to grab template=
=20
> parameters with 'for constexpr' is to have type list outside of template?
> =20
>
>> This will allow usage outside of template function and simplify complex=
=20
>> operation:
>> template<typename T>
>> using MetaFunc =3D std::tuple<int, T, T, char>;
>>
>>
>> int main()
>> {
>>     for constexpr (typename T : MetaFunc<long>)
>>     {
>>         f<T>();
>>     } //equal: `f<int>(); f<long>(); f<long>(); f<char>();`
>>     for constexpr (typename T : MetaFunc<char>)
>>     {
>>         for constexpr (typename TT : MetaFunc<T>)
>>         {
>>            g<T,TT>();
>>         }
>>     }
>> }
>>
>>
>>  I see one issue with this example. Your MetaFunc is template typedef an=
d=20
> instead of iteraating over single element list you are iterating through =
 4=20
> elements list since you are grabbing parameters of type mapped my templat=
e=20
> typedef but not parameters of teemplate typedef itself. The simpliest way=
=20
> to have list of types which is never can accidentally create some nonvoid=
=20
> variable is template typedef std::void_t which can be implemented as
>
> template<typename... T>
> using void_t =3D void;
>
> how the following loop should work then?
>
> for constexpr (typename T: void_t<int8_t, int16_t, int32_t, int64_t>) {
>     do_something();
> }
>
>
No, because type that is pass to `for` is `void` without any parameters. It=
=20
will behave same if you pass `void_t<int, long>` to template and look what=
=20
template specialization is chosen. It will be `void`.
=20

> My personal opinion on such feature: there should be separate syntax to=
=20
> grab template parameters like
>
> for constexpr (typename T: params_of<void_t<int8_t, int16_t, int32_t,=20
> int64_t>>) {
>     do_something();
> }
>
> but it require some extra work on how this should actually work. In D it'=
s=20
> possible to implement params_of in library code since it's possible to=20
> typedef parameters pack and then use it when needed. The following C++ co=
de=20
> rewritten in D works as expected:
>
> template<typename... L>
> struct test {
>     using params =3D L;
> };
>
> int main() {
>     for constexpr (typename T, test<char, int>::params) {
>         std::cout << sizeof(T) << std::endl;
>     }
> }
>
> From my personal point of view this way to have typelist outside of=20
> template is much better then grabbing parameters from some intermediate=
=20
> template which is needed only to enlist types you need. This approach als=
o=20
> allows to have better of your MetaFunc template without issues I've=20
> mentioned above.
>

My idea was that we have concrete template type with some parameters. Then=
=20
`for constexpr` will extract parameters of this template. This is why=20
template alias are skipped. They can never by concrete. They more like type=
=20
to type functions that templates.=20

--=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/71f9f321-59e4-452e-84d1-74d2c476c2de%40isocpp.or=
g.

------=_Part_1128_1958846099.1465859904297
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Monday, June 13, 2016 at 7:56:48 PM UTC+2, Serg=
ey Vidyuk 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"lt=
r">=D1=81=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0, 11 =D0=B8=D1=8E=D0=BD=D1=8F =
2016 =D0=B3., 1:10:04 UTC+6 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=
=B0=D1=82=D0=B5=D0=BB=D1=8C <a>inkwizyt...@gmail.com</a> =D0=BD=D0=B0=D0=BF=
=D0=B8=D1=81=D0=B0=D0=BB:<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">=C2=A0I think that `for constexpr` should be allowed to extracting=
 parameters from templates, some thing like that:<br><div><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color=
:#008">using</span><span style=3D"color:#000"> type </span><span style=3D"c=
olor:#660">=3D</span><span style=3D"color:#000"> std</span><span style=3D"c=
olor:#660">::</span><span style=3D"color:#000">tuple</span><span style=3D"c=
olor:#660">&lt;</span><span style=3D"color:#008">int</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#008">long</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
08">long</span><span style=3D"color:#660">,</span><span style=3D"color:#000=
"> </span><span style=3D"color:#008">char</span><span style=3D"color:#660">=
&gt;;</span><span style=3D"color:#000"><br><br></span><span style=3D"color:=
#008">int</span><span style=3D"color:#000"> main</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>=C2=A0 =C2=A0 </span><span sty=
le=3D"color:#008">for</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">constexpr</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> T </span><span style=3D"color:#660">:</span><span sty=
le=3D"color:#000"> type</span><span style=3D"color:#660">)</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#800">//without `...`</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#66=
0">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 f</sp=
an><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span=
><span style=3D"color:#660">&gt;();</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#800">//equal: `f&lt;int&gt;(); f&lt;l=
ong long&gt;(); f&lt;char&gt;();`</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#660">}</span></div></code></div><br></div></div></=
blockquote><div><br>Am I right tha the main and only reason you would like =
to grab template=20
parameters with &#39;for constexpr&#39; is to have type list outside of=20
template?<br>=C2=A0</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>This will allow usage outside of template function and simpli=
fy complex operation:<br><div style=3D"background-color:rgb(250,250,250);bo=
rder-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:b=
reak-word"><code><div><span style=3D"color:#008">template</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> T</span><span style=3D"color:#660">&gt;</span><span s=
tyle=3D"color:#000"><br></span><span style=3D"color:#008">using</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#606">MetaFunc</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><span =
style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span s=
tyle=3D"color:#000">tuple</span><span style=3D"color:#660">&lt;</span><span=
 style=3D"color:#008">int</span><span style=3D"color:#660">,</span><span st=
yle=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span style=3D"=
color:#000"> </span><span style=3D"color:#008">char</span><span style=3D"co=
lor:#660">&gt;;</span><span style=3D"color:#000"><br><br><br></span><span s=
tyle=3D"color:#008">int</span><span style=3D"color:#000"> main</span><span =
style=3D"color:#660">()</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </=
span><span style=3D"color:#008">for</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">constexpr</span><span style=3D"color:#000"> </=
span><span style=3D"color:#660">(</span><span style=3D"color:#008">typename=
</span><span style=3D"color:#000"> T </span><span style=3D"color:#660">:</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">MetaFunc<=
/span><span style=3D"color:#080">&lt;long&gt;</span><span style=3D"color:#6=
60">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 f</span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#000">T</span><span style=3D"color:#660">&gt;();</span><span style=3D"color=
:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#800">//equal: `f&lt;int&gt=
;(); f&lt;long&gt;(); f&lt;long&gt;(); f&lt;char&gt;();`</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">for</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">constexpr<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#660">(</span=
><span style=3D"color:#008">typename</span><span style=3D"color:#000"> T </=
span><span style=3D"color:#660">:</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#606">MetaFunc</span><span style=3D"color:#080">&lt;ch=
ar&gt;</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>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#00=
8">for</span><span style=3D"color:#000"> </span><span style=3D"color:#008">=
constexpr</span><span style=3D"color:#000"> </span><span style=3D"color:#66=
0">(</span><span style=3D"color:#008">typename</span><span style=3D"color:#=
000"> TT </span><span style=3D"color:#660">:</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#606">MetaFunc</span><span style=3D"color:#=
660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#66=
0">&gt;)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0g</span><span style=3D"color:#660">&l=
t;</span><span style=3D"color:#000">T</span><span style=3D"color:#660">,</s=
pan><span style=3D"color:#000">TT</span><span style=3D"color:#660">&gt;();<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><sp=
an 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"><b=
r></span><span style=3D"color:#660">}</span></div></code></div><br><br></di=
v></div></blockquote><div>=C2=A0I see one issue with this example. Your Met=
aFunc is template typedef and instead of iteraating over single element lis=
t you are iterating through=C2=A0 4 elements list since you are grabbing pa=
rameters of type mapped my template typedef but not parameters of teemplate=
 typedef itself. The simpliest way to have list of types which is never can=
 accidentally create some nonvoid variable is template typedef std::void_t =
which can be implemented as<br><br><div style=3D"background-color:rgb(250,2=
50,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;w=
ord-wrap:break-word"><code><div><span style=3D"color:#008">template</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</s=
pan><span style=3D"color:#660">...</span><span style=3D"color:#000"> T</spa=
n><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">using</span><span style=3D"color:#000"> void_=
t </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">void</span><span style=3D"color:#660">;</s=
pan><span style=3D"color:#000"><br></span></div></code></div><br>how the fo=
llowing loop should work then?<br><br><div style=3D"background-color:rgb(25=
0,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1p=
x;word-wrap:break-word"><code><div><span style=3D"color:#008">for</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#008">constexpr</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660">(</span><span=
 style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><s=
pan style=3D"color:#660">:</span><span style=3D"color:#000"> void_t</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#000">int8_t</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> int16_t</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> int32_t<=
/span><span style=3D"color:#660">,</span><span style=3D"color:#000"> int64_=
t</span><span style=3D"color:#660">&gt;)</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 do_something</span><span style=3D"color:#660">();</span><span=
 style=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span s=
tyle=3D"color:#000"><br></span></div></code></div><br></div></div></blockqu=
ote><div><br>No, because type that is pass to `for` is `void` without any p=
arameters. It will behave same if you pass `void_t&lt;int, long&gt;` to tem=
plate and look what template specialization is chosen. It will be `void`.<b=
r>=C2=A0</div><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"=
><div>My personal opinion on such feature: there should be separate syntax =
to grab template parameters like<br><br><div style=3D"background-color:rgb(=
250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:=
1px;word-wrap:break-word"><code><div><span style=3D"color:#008">for</span><=
span style=3D"color:#000"> </span><span style=3D"color:#008">constexpr</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">(</span><sp=
an style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span>=
<span style=3D"color:#660">:</span><span style=3D"color:#000"> params_of</s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">void_t=
</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">int=
8_t</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> in=
t16_t</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
int32_t</span><span style=3D"color:#660">,</span><span style=3D"color:#000"=
> int64_t</span><span style=3D"color:#660">&gt;&gt;)</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 do_something</span><span style=3D"color:#660">();</=
span><span style=3D"color:#000"><br></span><span style=3D"color:#660">}</sp=
an><span style=3D"color:#000"><br></span></div></code></div><br>but it requ=
ire some extra work on how this should actually work. In D it&#39;s possibl=
e to implement params_of in library code since it&#39;s possible to typedef=
 parameters pack and then use it when needed. The following C++ code rewrit=
ten in D works as expected:<br><br><div style=3D"background-color:rgb(250,2=
50,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;w=
ord-wrap:break-word"><code><div><span style=3D"color:#008">template</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</s=
pan><span style=3D"color:#660">...</span><span style=3D"color:#000"> L</spa=
n><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">struct</span><span style=3D"color:#000"> test=
 </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#008">using</span><span style=3D"=
color:#000"> </span><span style=3D"color:#008">params</span><span style=3D"=
color:#000"> </span><span style=3D"color:#660">=3D</span><span style=3D"col=
or:#000"> L</span><span style=3D"color:#660">;</span><span style=3D"color:#=
000"><br></span><span style=3D"color:#660">};</span><span style=3D"color:#0=
00"><br><br></span><span style=3D"color:#008">int</span><span style=3D"colo=
r:#000"> main</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 </span><span style=3D"color:#008">for</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#008">constexpr</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">(</span><span style=
=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> test</span><span sty=
le=3D"color:#660">&lt;</span><span style=3D"color:#008">char</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">int</span><span style=3D"color:#660">&gt;::</span><span sty=
le=3D"color:#008">params</span><span style=3D"color:#660">)</span><span sty=
le=3D"color:#000"> </span><span style=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 style=3D"color:#000"> </span><span style=3D"col=
or:#008">sizeof</span><span style=3D"color:#660">(</span><span style=3D"col=
or:#000">T</span><span style=3D"color:#660">)</span><span style=3D"color:#0=
00"> </span><span 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:#00=
0"><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></span></div></code></div><br>From my personal point of=
 view this way to have typelist outside of template is much better then gra=
bbing parameters from some intermediate template which is needed only to en=
list types you need. This approach also allows to have better of your MetaF=
unc template without issues I&#39;ve mentioned above.<br></div></div></bloc=
kquote><div><br>My idea was that we have concrete template type with some p=
arameters. Then `for constexpr` will extract parameters of this template. T=
his is why template alias are skipped. They can never by concrete. They mor=
e like type to type functions that templates. </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/71f9f321-59e4-452e-84d1-74d2c476c2de%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/71f9f321-59e4-452e-84d1-74d2c476c2de=
%40isocpp.org</a>.<br />

------=_Part_1128_1958846099.1465859904297--

------=_Part_1127_1727022655.1465859904296--

.
