Topic: non-type ref/ptr template template parameter


Author: Daemon Snake <swac31@gmail.com>
Date: Sun, 6 Aug 2017 16:42:03 -0700 (PDT)
Raw View
------=_Part_2625_1688749570.1502062923592
Content-Type: multipart/alternative;
 boundary="----=_Part_2626_703155958.1502062923594"

------=_Part_2626_703155958.1502062923594
Content-Type: text/plain; charset="UTF-8"

Hi,

since C++14 we have global/static template variable,
and where un-specialized templated types (using, class, struct) are allowed
in template parameter lists since always.
template<template<class, int, ...> class Name>

We still have no way of doing the same with templated variables (not
talking about values here). Something like this:
template<template<class, int, ...> auto& somevar>>
template<template<class, int, ...> auto* somevar>>
I suppose it was left out because at the time we didn't have a way to
express it but we now have non-type auto template parameters.

Allowing this wouldn't cause any change in the mangling (as for template
template type parameters only the mangled Id of the variable is used)
//types
template <class...> struct A;
template <template<class...> class> void func() {}
func<A> => _Z4funcI1AEvv

//ref
template <class...> static constexpr auto A = ...;
template <template<class...>auto &> void func() {}
func<A>=> _Z4funcI1AEvv no changes, use the mangled id and that's all.

If adopted it would allow templated function as template parameters:
template <class...>
struct variant
{
 template <template<class> auto&Visitor>
 auto type_visit() {}
};

template <class T>
void type_repr() {}

int main()
{
 auto v = returns_variant();
 v.visit<type_repr>();
}

Therefor allow std::apply with templated functions:
template <template<class...> auto& func, class Tuple, std::size_t... Indexs>
auto apply_imp(Tuple&& t, std::index_sequence<Indexs...>)
{
 return std::invoke(func<decltype(std::get<Indexs>(std::forward<Tuple>(tuple
)))...>, std::get<Indexs>(std::forward<Tuple>(tuple))...);
 //maybe allow func(args...) to evalute into
func<decltype(args)...>(args...) if and only if func is a function
pointer/reference and the template list matches the argument list.
}

template <template<class> auto& func, class Tuple>
auto apply(Tuple&& t)
{
 apply_impl<func>(std::forward<Tuple>(t), std::make_index_sequence<std::
tuple_size_v<Tuple>>{});
}

void func(auto&&...) {}

int main()
{
 invoke<func>(returns_tuple());
}

--
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/e11a60de-df33-44e6-abdf-1f51efd3400f%40isocpp.org.

------=_Part_2626_703155958.1502062923594
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>since C++14 we have global/static t=
emplate variable,</div><div>and where un-specialized templated types (using=
, class, struct) are allowed in template parameter lists since always.</div=
><div><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 2=
50); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1=
px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpr=
ettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">templa=
te</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=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"color: #008;" class=3D"styled-by-prettify">class</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">...&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">class<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">Name</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span></div></code></=
div><div><br></div>We still have no way of doing the same with templated va=
riables (not talking about values here). Something like this:</div><div><di=
v class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bord=
er-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-=
wrap: break-word;"><code class=3D"prettyprint"><span class=3D"styled-by-pre=
ttify" style=3D"color: rgb(0, 0, 136);">template</span><span class=3D"style=
d-by-prettify" style=3D"color: rgb(102, 102, 0);">&lt;</span><span class=3D=
"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">template</span><span =
class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&lt;</span>=
<span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">class</=
span><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">=
,</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);">=
=C2=A0</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 1=
36);">int</span><span class=3D"styled-by-prettify" style=3D"color: rgb(102,=
 102, 0);">,</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0=
, 0, 0);">=C2=A0</span><span class=3D"styled-by-prettify" style=3D"color: r=
gb(102, 102, 0);">...&gt;</span><span class=3D"styled-by-prettify" style=3D=
"color: rgb(0, 0, 0);">=C2=A0</span><span class=3D"styled-by-prettify" styl=
e=3D"color: rgb(0, 0, 136);">auto</span><span class=3D"styled-by-prettify" =
style=3D"color: rgb(102, 102, 0);">&amp;</span><span class=3D"styled-by-pre=
ttify" style=3D"color: rgb(0, 0, 0);">=C2=A0somevar</span><span class=3D"st=
yled-by-prettify" style=3D"color: rgb(102, 102, 0);">&gt;&gt;</span><span c=
lass=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);"><br></span><span=
 class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);">template</sp=
an><span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&l=
t;</span><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 136);=
">template</span><span class=3D"styled-by-prettify" style=3D"color: rgb(102=
, 102, 0);">&lt;</span><span class=3D"styled-by-prettify" style=3D"color: r=
gb(0, 0, 136);">class</span><span class=3D"styled-by-prettify" style=3D"col=
or: rgb(102, 102, 0);">,</span><span class=3D"styled-by-prettify" style=3D"=
color: rgb(0, 0, 0);">=C2=A0</span><span class=3D"styled-by-prettify" style=
=3D"color: rgb(0, 0, 136);">int</span><span class=3D"styled-by-prettify" st=
yle=3D"color: rgb(102, 102, 0);">,</span><span class=3D"styled-by-prettify"=
 style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span class=3D"styled-by-prett=
ify" style=3D"color: rgb(102, 102, 0);">...&gt;</span><span class=3D"styled=
-by-prettify" style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span class=3D"st=
yled-by-prettify" style=3D"color: rgb(0, 0, 136);">auto</span><span class=
=3D"styled-by-prettify"><font color=3D"#666600">*</font></span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);">=C2=A0somevar</span>=
<span class=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">&gt;&=
gt;</span></code></div></div><div>I suppose it was left out because at the =
time we didn&#39;t have a way to express it but we now have non-type auto t=
emplate parameters.</div><div><br></div><div>Allowing this wouldn&#39;t cau=
se any change in the mangling (as for template template type parameters onl=
y the mangled Id of the variable is used)</div><div class=3D"prettyprint" s=
tyle=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 1=
87); border-style: solid; border-width: 1px; word-wrap: break-word;"><code =
class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #=
800;" class=3D"styled-by-prettify">//types</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">template</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">class</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">...&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> A</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><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"colo=
r: #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">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">class</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: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> func</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"colo=
r: #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></span><font color=3D"#000000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">func</span></font><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">A</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">=3D&gt;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> _Z4funcI1AEvv<br><br></span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//ref</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span><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">clas=
s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">static</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> A </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">=3D</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>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><font colo=
r=3D"#000000"><span style=3D"color: #008;" class=3D"styled-by-prettify">tem=
plate</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: #660;" class=3D"styled-by-prettify">...&gt;</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&amp;&gt;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> func</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>f=
unc</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">A</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&gt;=3D&gt;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> _Z4funcI1AEvv </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">no</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> changes</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">use</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> the mangled id </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">and</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> that</span><span style=3D"color: #080;" class=3D"s=
tyled-by-prettify">&#39;s all.</span></font></div></code></div><div><br></d=
iv><div>If adopted it would allow templated function as template parameters=
:</div><div class=3D"prettyprint" 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 class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">templ=
ate</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 styl=
e=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"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> variant<br></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: #000;" class=
=3D"styled-by-prettify">=C2=A0</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">template</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">template</span><span style=3D"color: #080;" class=3D"styled-by-prettify"=
>&lt;class&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span=
><span style=3D"color: #606;" class=3D"styled-by-prettify">Visitor</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> type_visit</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">=C2=A0</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{}</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">template</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </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;" class=3D"styled-by-prettify"> T</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> type_repr</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=
"styled-by-prettify">{}</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> main<=
/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><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> v </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> returns_variant</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><span class=3D"styled-by-prettify">=C2=A0v</span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(102, 102, 0);">.</span><span cl=
ass=3D"styled-by-prettify">visit</span><span class=3D"styled-by-prettify" s=
tyle=3D"color: rgb(0, 136, 0);">&lt;type_repr&gt;</span><span class=3D"styl=
ed-by-prettify" style=3D"color: rgb(102, 102, 0);">();</span><span class=3D=
"styled-by-prettify"><br></span></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span></div></code></div><div><br></div><div>Ther=
efor allow std::apply with templated functions:</div><div class=3D"prettypr=
int" 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 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"colo=
r: #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">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">class</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: #008;" class=3D"styled-by-prettify"=
>auto</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> func</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">Tuple</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>size_t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Indexs</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"co=
lor: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> apply_imp</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #606;" cla=
ss=3D"styled-by-prettify">Tuple</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> t</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">index_sequ=
ence</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">Indexs</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 s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">return</span><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">invoke</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">func</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">d=
ecltype</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">get</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">Indexs</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">forward</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Tuple</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt=
;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">)))...&gt;,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">get</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#606;" class=3D"styled-by-prettify">Indexs</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #000;" cl=
ass=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-b=
y-prettify">forward</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">Tuple</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&g=
t;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">))...);</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0</spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">//maybe allow f=
unc(args...) to evalute into func&lt;decltype(args)...&gt;(args...) if and =
only if func is a function pointer/reference and the template list matches =
the argument list.</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">template<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&lt;class&gt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> func</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Tuple</=
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 s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> apply</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Tuple</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> t</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>=C2=A0apply_impl</span><span style=3D"color: #080;" class=3D"styled-by-pre=
ttify">&lt;func&gt;</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">forward</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Tuple</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">t</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">),</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">make_index_sequence</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">t=
uple_size_v</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>&lt;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Tuple=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&gt;{}=
);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> func</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">auto</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&amp;&amp;...)</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </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></span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> main</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-prettify">{</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0invoke</span><sp=
an style=3D"color: #080;" class=3D"styled-by-prettify">&lt;func&gt;</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">returns_tuple</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">());</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></div></code></div><br></d=
iv>

<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/e11a60de-df33-44e6-abdf-1f51efd3400f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e11a60de-df33-44e6-abdf-1f51efd3400f=
%40isocpp.org</a>.<br />

------=_Part_2626_703155958.1502062923594--

------=_Part_2625_1688749570.1502062923592--

.


Author: Zhihao Yuan <zy@miator.net>
Date: Sun, 6 Aug 2017 20:19:34 -0500
Raw View
On Sun, Aug 6, 2017 at 6:42 PM, Daemon Snake <swac31@gmail.com> wrote:
> Hi,
>
> since C++14 we have global/static template variable,
> and where un-specialized templated types (using, class, struct) are allowed
> in template parameter lists since always.
> template<template<class, int, ...> class Name>
>
> We still have no way of doing the same with templated variables (not talking
> about values here). Something like this:
> template<template<class, int, ...> auto& somevar>>
> template<template<class, int, ...> auto* somevar>>

and

  template<template<class, int, ...> auto somevar>>

> I suppose it was left out because at the time we didn't have a way to
> express it but we now have non-type auto template parameters.
>

Yes.  Early this year on reflectors we had a discussion
about this and received supports.  The following is
the design that I plan to make it into a paper for the
next meeting:

[Quote:

Proposes to allow passing variable templates as
template arguments

  all_satisfy<is_trivially_destructible_v, T...>

by adding a new kind of template template parameter

  template <template <typename...> auto F, typename... T>
  constexpr bool all_satisfy = and_v<F<some_traits_t<T>>...>;

, which is a missing piece in the language:

| `typename` T                  | `template <typename> typename T`       |
| (type template parameter)     | (_type_ template template parameter)   |
| ----------------------------- | -------------------------------------- |
| `auto V`                      | `template <typename> auto V`           |
| (non-type template parameter) | (non-type template template parameter) |

Being said that they are non-type template template
parameters, instantiating them does not necessarily result
in variables acceptable as non-type template parameters.

We also want to allow passing overload sets as arguments
to this new kind of template template parameters

  template<typename T> void f();
  template<template<typename> auto &> struct B {};

  B<f>();

without the need of a separate variable template definition

  template <typename T>
  auto& r = f<T>;

  B<r>();

, assuming we can cheaply specify and implement this.

--end quote]

I find the use cases you raised interesting, so
I will contact you for coauthoring when I plan
to include these use cases.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

--
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/CAGsORuDnWjA3W3xYrzz6KHS8MsUeT0wAoM5NgfxeSnTzVWr%2B_w%40mail.gmail.com.

.


Author: Daemon Snake <swac31@gmail.com>
Date: Mon, 7 Aug 2017 01:51:56 -0700 (PDT)
Raw View
------=_Part_2972_260313358.1502095916884
Content-Type: multipart/alternative;
 boundary="----=_Part_2973_1757682245.1502095916884"

------=_Part_2973_1757682245.1502095916884
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Le lundi 7 ao=C3=BBt 2017 03:20:06 UTC+2, Zhihao Yuan a =C3=A9crit :
>
> Yes.  Early this year on reflectors we had a discussion=20
> about this and received supports.  The following is=20
> the design that I plan to make it into a paper for the=20
> next meeting:=20
>
That's great! Finger crossed!
=20
 | template<template<class, int, ...> auto somevar>>=20

I though about it and I now believe that the above should actually be the=
=20
only thing allowed.

I extrapolated the rules of auto non-type template parameters and got this.
This is not useful.
template<template<class, int, ...> auto somevar>> //pointer to member=20
function and everything except static non-const variable.
template<template<class, int, ...> auto& somevar>> //static const or not=20
variable, function reference. Doesn't allow pointer to member function.
template<template<class, int, ...> auto* somevar>> //function pointer.=20
Doesn't allow pointer to member function.

I find the use cases you raised interesting, so=20
> I will contact you for coauthoring when I plan=20
> to include these use cases.=20
>
Fantastic.
Please feel free to contact me anytime.

--=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/a4a7398f-0b0a-4461-8b73-dd56cd6dfaa8%40isocpp.or=
g.

------=_Part_2973_1757682245.1502095916884
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Le lundi 7 ao=C3=BBt 2017 03:20:06 UTC+2, Zhihao Yuan a =
=C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Yes. =C2=A0Ea=
rly this year on reflectors we had a discussion
<br>about this and received supports. =C2=A0The following is
<br>the design that I plan to make it into a paper for the
<br>next meeting:
<br></blockquote><div>That&#39;s great! Finger crossed!</div><div>=C2=A0</d=
iv><div class=3D"prettyprint" 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 class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0</s=
pan><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: #008;" class=3D"styled-by-prettify">template</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">class</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan 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: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> somevar</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&gt;&gt;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> <br><br></span></div></code></div><div>I=
 though about it and I now believe that the above should actually be the on=
ly thing allowed.<br></div><div><br></div><div>I extrapolated the rules of =
auto non-type template parameters and got this.</div><div>This is not usefu=
l.</div><div class=3D"prettyprint" 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 class=3D"prettyprint"><div class=3D"sub=
prettyprint">template&lt;<font color=3D"#000000">template&lt;class, int, ..=
..&gt; auto somevar&gt;&gt; //</font><span style=3D"color: rgb(136, 0, 0); f=
ont-family: Arial, Helvetica, sans-serif;">pointer to member function and=
=C2=A0</span><span style=3D"color: rgb(136, 0, 0); font-family: Arial, Helv=
etica, sans-serif;">everything except static non-const variable.</span></di=
v><div class=3D"subprettyprint">template&lt;template&lt;class, int, ...&gt;=
 auto&amp; somevar&gt;&gt; //static const or not variable, function referen=
ce. Doesn&#39;t allow pointer to member function.<br>template&lt;template&l=
t;class, int, ...&gt; auto* somevar&gt;&gt; //function pointer. Doesn&#39;t=
 allow pointer to member function.</div></code></div><div><br></div><blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;">I find the use cases you raised inter=
esting, so
<br>I will contact you for coauthoring when I plan
<br>to include these use cases.
<br></blockquote><div>Fantastic.</div><div>Please feel free to contact me a=
nytime.</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/a4a7398f-0b0a-4461-8b73-dd56cd6dfaa8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a4a7398f-0b0a-4461-8b73-dd56cd6dfaa8=
%40isocpp.org</a>.<br />

------=_Part_2973_1757682245.1502095916884--

------=_Part_2972_260313358.1502095916884--

.