220 26324 <1015518c-c0e4-4397-b946-df7834a2c3c0@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Sergey Vidyuk <sir.vestnik@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: statement folding on variadic templates
 parameters pack
Date: Mon, 13 Jun 2016 10:56:47 -0700 (PDT)
Lines: 392
Approved: news@gmane.org
Message-ID: <1015518c-c0e4-4397-b946-df7834a2c3c0@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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_522_172920184.1465840607875"
X-Trace: ger.gmane.org 1465840757 23657 80.91.229.3 (13 Jun 2016 17:59:17 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 13 Jun 2016 17:59:17 +0000 (UTC)
Cc: inkwizytoryankes@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCB6HO5JRMARBYPH7O5AKGQERIBA65Q@isocpp.org Mon Jun 13 19:59:17 2016
Return-path: <std-proposals+bncBCB6HO5JRMARBYPH7O5AKGQERIBA65Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f70.google.com ([209.85.220.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB6HO5JRMARBYPH7O5AKGQERIBA65Q@isocpp.org>)
	id 1bCW6W-0002g8-12
	for gclcip-std-proposals@m.gmane.org; Mon, 13 Jun 2016 19:56:52 +0200
Original-Received: by mail-pa0-f70.google.com with SMTP id ug1sf218493924pab.3
        for <gclcip-std-proposals@m.gmane.org>; Mon, 13 Jun 2016 10:56:51 -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=0PKLcKyYwy6uA8qCRqtDX3DCoPx9YUivgSvCah2M58M=;
        b=vNTgmqry1pNHzjxRmgVtYONMARzqzd5apaikkNbTsuwQZ040nnUNhVzNNUfO+9qNFZ
         W5ecyPLxY3nizBGzVFs1V78nGzxPONhvirz/Z5fct4FGbkeLu0wudhoM2+Euhx465Z1J
         LkeBudW827CfvggVmd+pjHUziRRl15Nus5jIg3yEJstMTg42NqubXDHithCwZFEMzn6R
         bXBGjEDgz5uFys2LPiILUGXUMZeh6DYK+wjHY5zHLWyJlPjlRVbYd55j32YeKAxUkuty
         kYqxSBaIupPxIct3c/a3iDwSSxwZz/pjxVpydoYTqLPwIrRuVLXGCtTkD+nptCzWp0CJ
         ERbw==
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=0PKLcKyYwy6uA8qCRqtDX3DCoPx9YUivgSvCah2M58M=;
        b=VcieeVcHYAHM/+ccg5yqNjDNOCIdqzuaYti/J8tdPhsftDodRbwbb5vAZlQCNBxdYV
         o3tp6dXotvMgoAIJz2WoZAxqjXHokl5fECajrKn35vlF+XB2Vl2jTqu66jqcm+1CBK/y
         Qw6qnohzcaKQ3cm+R3Ma7US+P2uRHnfjNG3IpTp/eH8KBca3PDRwC+fT3QpOPW00DEVX
         of01cqskudZ41oMVJwl1H8YIUe+9KFe4gLLK7WfZPrbAN/ZBL0Bl7IoV4pOCkiwH0px7
         w/LWpf3JvADTDo09sobJkk7iY+5S0c+pGtNmER1CaJ3JsCl+DwsLUobLsNtl7bEwTdER
         QJgQ==
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=0PKLcKyYwy6uA8qCRqtDX3DCoPx9YUivgSvCah2M58M=;
        b=CMcREJP6BFCBSrZwlAcO51HRV/basHbHHYQpFoPDzFfq7wrqg+t+cGNTMIKbvnqRGD
         ywl8/AA7PW/QlNCtNfjGDu+VkcU2S0YODXJ8pbHSCJtKo6zUZTAQ4mrTbC7HpriCqOC3
         /4TFhBXPimtFcsZnnE4FD1O8YvO9KJHiRjizgs2CGjoYauK4hfcDZTcde28no8xnFawf
         6nkKylUX549Vo+UVlSq8tYwuFAfA+aAthfzSCcocIyPu3C/UzzbQQpv9Q6vD/+3rX6Ur
         Ioxle3tCcjkUUJe14KQWzS571+EqouHe96B/dQeNVld5NaPzfle38j6QOYI2LJqZ3Fdn
         z8QA==
X-Gm-Message-State: ALyK8tJOcKagn6P1NnBT403RnPypJnt7oYiX418I/8IuRe5J/p5j0AakByztDERlUdGrzA==
X-Received: by 10.66.142.41 with SMTP id rt9mr13455032pab.3.1465840610488;
        Mon, 13 Jun 2016 10:56:50 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.135.197 with SMTP id f188ls115381ite.44.gmail; Mon, 13 Jun
 2016 10:56:49 -0700 (PDT)
X-Received: by 10.36.253.132 with SMTP id m126mr285898ith.10.1465840609111;
        Mon, 13 Jun 2016 10:56:49 -0700 (PDT)
In-Reply-To: <9c425e18-e592-4cfd-9e41-b37b212a6b9d@isocpp.org>
X-Original-Sender: sir.vestnik@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:26324
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26324>

------=_Part_522_172920184.1465840607875
Content-Type: multipart/alternative; 
	boundary="----=_Part_523_718919558.1465840607876"

------=_Part_523_718919558.1465840607876
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

=D1=81=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0, 11 =D0=B8=D1=8E=D0=BD=D1=8F 201=
6 =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 and=
=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 template=
=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();
}

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++ code=
=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 also=
=20
allows to have better of your MetaFunc template without issues I've=20
mentioned above.

--=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/1015518c-c0e4-4397-b946-df7834a2c3c0%40isocpp.or=
g.

------=_Part_523_718919558.1465840607876
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">=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 inkwizyt...@gmail.com =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><di=
v 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">using</span><span style=3D"color:#000"> type </span><s=
pan style=3D"color:#660">=3D</span><span style=3D"color:#000"> std</span><s=
pan style=3D"color:#660">::</span><span style=3D"color:#000">tuple</span><s=
pan style=3D"color:#660">&lt;</span><span style=3D"color:#008">int</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#008">long</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">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><spa=
n 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 style=3D"color:#008">for</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">constexpr</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">(</span><span style=3D"color:#008">typena=
me</span><span style=3D"color:#000"> T </span><span style=3D"color:#660">:<=
/span><span style=3D"color:#000"> type</span><span style=3D"color:#660">)</=
span><span style=3D"color:#000"> </span><span style=3D"color:#800">//withou=
t `...`</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span sty=
le=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"col=
or:#000">T</span><span style=3D"color:#660">&gt;();</span><span style=3D"co=
lor:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#800">//equal: `f&lt;int=
&gt;(); f&lt;long long&gt;(); f&lt;char&gt;();`</span><span style=3D"color:=
#000"><br></span><span style=3D"color:#660">}</span></div></code></div><br>=
</div></div></blockquote><div><br>Am I right tha the main and only reason y=
ou 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 sim=
plify complex operation:<br><div style=3D"background-color:rgb(250,250,250)=
;border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wra=
p:break-word"><code><div><span style=3D"color:#008">template</span><span st=
yle=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><sp=
an style=3D"color:#000"> T</span><span style=3D"color:#660">&gt;</span><spa=
n style=3D"color:#000"><br></span><span style=3D"color:#008">using</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#606">MetaFunc</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><sp=
an style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><spa=
n style=3D"color:#000">tuple</span><span style=3D"color:#660">&lt;</span><s=
pan style=3D"color:#008">int</span><span style=3D"color:#660">,</span><span=
 style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span sty=
le=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"color:#660">&gt;;</span><span style=3D"color:#000"><br><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 style=3D"color:#008">for</span><span style=3D"color:#000">=
 </span><span style=3D"color:#008">constexpr</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#660">(</span><span style=3D"color:#008">ty=
pename</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">Met=
aFunc</span><span style=3D"color:#080">&lt;long&gt;</span><span style=3D"co=
lor:#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 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><s=
pan style=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">fo=
r</span><span style=3D"color:#000"> </span><span style=3D"color:#008">const=
expr</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;char&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 styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"colo=
r:#008">for</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">constexpr</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#660">(</span><span style=3D"color:#008">typename</span><span style=3D"co=
lor:#000"> TT </span><span style=3D"color:#660">:</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#606">MetaFunc</span><span style=3D"co=
lor:#660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"colo=
r:#660">&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"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0g</span><span style=3D"color:#66=
0">&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#660"=
>,</span><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 </spa=
n><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></div></code></div><br><br><=
/div></div></blockquote><div>=C2=A0I see one issue with this example. Your =
MetaFunc is template typedef and instead of iteraating over single element =
list you are iterating through=C2=A0 4 elements list since you are grabbing=
 parameters of type mapped my template typedef but not parameters of teempl=
ate 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 class=3D"prettyprint" style=3D"b=
ackground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bord=
er-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"=
prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> T</span><span style=3D"color: #660;" class=3D"styled-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-prettify">using</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> void_t </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span></div></code></div><br>how the followi=
ng loop should work then?<br><br><div class=3D"prettyprint" style=3D"backgr=
ound-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-st=
yle: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D=
"styled-by-prettify">for</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">constexpr</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> void_t</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">int8_t</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> int16_t</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> int32_t</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> i=
nt64_t</span><span style=3D"color: #660;" 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 styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 do_someth=
ing</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></di=
v><br>My personal opinion on such feature: there should be separate syntax =
to grab template parameters like<br><br><div class=3D"prettyprint" style=3D=
"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bo=
rder-style: solid; border-width: 1px; word-wrap: break-word;"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">for</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">constexpr</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">type=
name</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> params_of</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">void_t</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">int8_t</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> int16_t</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> int32_t</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> int64_t</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&gt;&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=
 do_something</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">();</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></=
code></div><br>but it require some extra work on how this should actually w=
ork. In D it&#39;s possible 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 rewritten in D works as expected:<br><br><div class=3D"=
prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break=
-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> L</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> test </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span><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-pretti=
fy">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">params</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> L</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> main</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">for</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> test</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">char=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&gt;::</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">params</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">cout </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">sizeof</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">endl</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span></div></code></div><br>From my personal point of view this way to ha=
ve typelist outside of template is much better then grabbing parameters fro=
m some intermediate template which is needed only to enlist types you need.=
 This approach also allows to have better of your MetaFunc template without=
 issues I&#39;ve mentioned above.<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/1015518c-c0e4-4397-b946-df7834a2c3c0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1015518c-c0e4-4397-b946-df7834a2c3c0=
%40isocpp.org</a>.<br />

------=_Part_523_718919558.1465840607876--

------=_Part_522_172920184.1465840607875--

.
