Topic: Relaxing requirements on template template
Author: David Krauss <potswa@gmail.com>
Date: Wed, 2 Sep 2015 01:13:25 +0800
Raw View
--Apple-Mail=_BDA46231-4185-434C-BCB2-31503FC8E147
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
> On 2015=E2=80=9309=E2=80=9301, at 11:57 PM, Bengt Gustafsson <bengt.gusta=
fsson@beamways.com> wrote:
>=20
> Does anyone know what the rationale is behind this restriction?
As far as I know, it=E2=80=99s the only way to count the number of paramete=
rs in a class template.
The priorities are backwards, but compatibility inertia is pretty strong.
Note that alias templates can provide the illusion that classes like vector=
and basic_string have only one parameter.
template< typename t >
using univec =3D std::vector< t >;
template< typename t >
using unistring =3D std::string< t >;
These aliases can be used as default arguments to template template paramet=
ers.
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--Apple-Mail=_BDA46231-4185-434C-BCB2-31503FC8E147
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9309=
=E2=80=9301, at 11:57 PM, Bengt Gustafsson <<a href=3D"mailto:bengt.gust=
afsson@beamways.com" class=3D"">bengt.gustafsson@beamways.com</a>> wrote=
:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div style=
=3D"font-family: Helvetica; font-size: 12px; font-style: normal; font-varia=
nt: normal; font-weight: normal; letter-spacing: normal; line-height: norma=
l; orphans: auto; text-align: start; text-indent: 0px; text-transform: none=
; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke=
-width: 0px;" class=3D"">Does anyone know what the rationale is behind this=
restriction?</div></div></blockquote></div><br class=3D""><div class=3D"">=
As far as I know, it=E2=80=99s the only way to count the number of paramete=
rs in a class template.</div><div class=3D""><br class=3D""></div><div clas=
s=3D"">The priorities are backwards, but compatibility inertia is pretty st=
rong.</div><div class=3D""><br class=3D""></div><div class=3D"">Note that a=
lias templates can provide the illusion that classes like <font face=3D"Cou=
rier" class=3D"">vector</font> and <font face=3D"Courier" class=3D"">basic_=
string</font> have only one parameter.</div><div class=3D""><br class=3D"">=
</div><div class=3D""><font face=3D"Courier" class=3D"">template< typena=
me t ></font></div><div class=3D""><font face=3D"Courier" class=3D"">usi=
ng univec =3D std::vector< t >;</font></div><div class=3D""><font fac=
e=3D"Courier" class=3D""><br class=3D""></font></div><div class=3D""><div c=
lass=3D""><font face=3D"Courier" class=3D"">template< typename t ></f=
ont></div><div class=3D""><font face=3D"Courier" class=3D"">using unistring=
=3D std::string< t >;</font></div><div class=3D""><br class=3D""></d=
iv></div><div class=3D"">These aliases can be used as default arguments to =
template template parameters.</div><div class=3D""><br class=3D""></div></b=
ody></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--Apple-Mail=_BDA46231-4185-434C-BCB2-31503FC8E147--
.
Author: Christof Meerwald <cmeerw@cmeerw.org>
Date: Tue, 1 Sep 2015 21:05:27 +0200
Raw View
On Tue, Sep 01, 2015 at 08:57:03AM -0700, Bengt Gustafsson wrote:
> Today a template template parameter can only be matched by a template class
> with exactly the same set of template parameters. Default parameters or
> variadic parameters are ignored.
>
> Example:
>
> template<template<typename> class TPL> class X {
> TPL<int> mVar;
> };
>
> template<typename A, typename B = int> struct Y {
> };
>
> X<Y> fee; // ERROR: Y has too many template parameters, even though one
> has a default.
>
> template<typename... Ts> struct A {
> };
>
> X<A> foo; // ERROR: A has wrong template parameters, although A can be
> instantiated with one type, just as X will do.
>
>
> Does anyone know what the rationale is behind this restriction?
The current rules are actually pretty much the opposite of what you
would expect, see
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf for
some explanation (and yes, it does seem to be kind of backwards - but
I am not sure if there is a way to make both use cases work...)
Christof
--
http://cmeerw.org sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Wed, 2 Sep 2015 00:41:52 -0700 (PDT)
Raw View
------=_Part_1299_1786054117.1441179712798
Content-Type: multipart/alternative;
boundary="----=_Part_1300_1353911105.1441179712799"
------=_Part_1300_1353911105.1441179712799
Content-Type: text/plain; charset=UTF-8
@Cristof: I don't see the connection. AFAIK what is described in N2555
currently is in the language, you can do this:
template<template<typename...> TPL, typename... Us> class X<TPL<Us...>> {};
What I was talking about is to be able to supply a variadic template class
when a n-ary is asked for, basically. (And similarly one that has
additional, but defaulted parameters).
@David:
I understand your answer to mean: "Someone has likely used this
(mis)feature to check how many template parameters a template has,
typically in some SFINAE situation". The using trick can save the day in
some situations, I guess.
Gien the above it seems that this proposal is not possible to do. Thanks
for the clarification! It is a pity though that this prevents some nice
"upgrades" of existing class templates, forcing the invention of new
(probably less and less obvious) names in the std namespace.
Den tisdag 1 september 2015 kl. 21:05:30 UTC+2 skrev Christof Meerwald:
>
> On Tue, Sep 01, 2015 at 08:57:03AM -0700, Bengt Gustafsson wrote:
> > Today a template template parameter can only be matched by a template
> class
> > with exactly the same set of template parameters. Default parameters or
> > variadic parameters are ignored.
> >
> > Example:
> >
> > template<template<typename> class TPL> class X {
> > TPL<int> mVar;
> > };
> >
> > template<typename A, typename B = int> struct Y {
> > };
> >
> > X<Y> fee; // ERROR: Y has too many template parameters, even though
> one
> > has a default.
> >
> > template<typename... Ts> struct A {
> > };
> >
> > X<A> foo; // ERROR: A has wrong template parameters, although A can
> be
> > instantiated with one type, just as X will do.
> >
> >
> > Does anyone know what the rationale is behind this restriction?
>
> The current rules are actually pretty much the opposite of what you
> would expect, see
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf for
> some explanation (and yes, it does seem to be kind of backwards - but
> I am not sure if there is a way to make both use cases work...)
>
>
> Christof
>
> --
>
> http://cmeerw.org sip:cmeerw at cmeerw.org
> mailto:cmeerw <javascript:> at cmeerw.org xmpp:cmeerw
> at cmeerw.org
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_1300_1353911105.1441179712799
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">@Cristof: I don't see the connection. AFAIK what is de=
scribed in N2555 currently is in the language, you can do this:<div><br></d=
iv><div>template<template<typename...> TPL, typename... Us> cla=
ss X<TPL<Us...>> {};</div><div><br></div><div>What I was talkin=
g about is to be able to supply a variadic template class when a n-ary is a=
sked for, basically. (And similarly one that has additional, but defaulted =
parameters).</div><div><br></div><div>@David:</div><div><br></div><div>I un=
derstand your answer to mean: "Someone has likely used this (mis)featu=
re to check how many template parameters a template has, typically in some =
SFINAE situation". The using trick can save the day in some situations=
, I guess.</div><div><br></div><div>Gien the above it seems that this propo=
sal is not possible to do. Thanks for the clarification! It is a pity thoug=
h that this prevents some nice "upgrades" of existing class templ=
ates, forcing the invention of new (probably less and less obvious) names i=
n the std namespace.</div><div><br><div><br>Den tisdag 1 september 2015 kl.=
21:05:30 UTC+2 skrev Christof Meerwald:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;">On Tue, Sep 01, 2015 at 08:57:03AM -0700, Bengt Gustafsson wrote:
<br>> Today a template template parameter can only be matched by a templ=
ate class=20
<br>> with exactly the same set of template parameters. Default paramete=
rs or=20
<br>> variadic parameters are ignored.
<br>>=20
<br>> Example:
<br>>=20
<br>> template<template<typename> class TPL> class X {
<br>> =C2=A0TPL<int> mVar;
<br>> };
<br>>=20
<br>> template<typename A, typename B =3D int> struct Y {
<br>> };
<br>>=20
<br>> X<Y> fee; =C2=A0 // ERROR: Y has too many template parameter=
s, even though one=20
<br>> has a default.
<br>>=20
<br>> template<typename... Ts> struct A {
<br>> };
<br>>=20
<br>> X<A> foo; =C2=A0 =C2=A0// ERROR: A has wrong template parame=
ters, although A can be=20
<br>> instantiated with one type, just as X will do.
<br>>=20
<br>>=20
<br>> Does anyone know what the rationale is behind this restriction?
<br>
<br>The current rules are actually pretty much the opposite of what you
<br>would expect, see
<br><a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n255=
5.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'h=
ttp://www.google.com/url?q\75http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2F=
wg21%2Fdocs%2Fpapers%2F2008%2Fn2555.pdf\46sa\75D\46sntz\0751\46usg\75AFQjCN=
F9SKVYNcipkSVy0QCe4qfNJ7A8Wg';return true;" onclick=3D"this.href=3D'=
;http://www.google.com/url?q\75http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%=
2Fwg21%2Fdocs%2Fpapers%2F2008%2Fn2555.pdf\46sa\75D\46sntz\0751\46usg\75AFQj=
CNF9SKVYNcipkSVy0QCe4qfNJ7A8Wg';return true;">http://www.open-std.org/j=
tc1/<wbr>sc22/wg21/docs/papers/2008/<wbr>n2555.pdf</a> for
<br>some explanation (and yes, it does seem to be kind of backwards - but
<br>I am not sure if there is a way to make both use cases work...)
<br>
<br>
<br>Christof
<br>
<br>--=20
<br>
<br><a href=3D"http://cmeerw.org" target=3D"_blank" rel=3D"nofollow" onmous=
edown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fcmeerw=
..org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4TmaRnGnQ';r=
eturn true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http=
%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4=
TmaRnGnQ';return true;">http://cmeerw.org</a> =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0sip:cmeerw at <a href=3D"http://cmeerw.org" target=3D"_blank" rel=3D"=
nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75htt=
p%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS=
4TmaRnGnQ';return true;" onclick=3D"this.href=3D'http://www.google.=
com/url?q\75http%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrP=
Znc6fRTa7r6eYuS4TmaRnGnQ';return true;">cmeerw.org</a>
<br>mailto:<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=
=3D"cyEon4Y_CAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascri=
pt:';return true;" onclick=3D"this.href=3D'javascript:';return =
true;">cmeerw</a> at <a href=3D"http://cmeerw.org" target=3D"_blank" rel=3D=
"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75ht=
tp%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYu=
S4TmaRnGnQ';return true;" onclick=3D"this.href=3D'http://www.google=
..com/url?q\75http%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKr=
PZnc6fRTa7r6eYuS4TmaRnGnQ';return true;">cmeerw.org</a> =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 xmpp:cmeerw at <a href=3D"=
http://cmeerw.org" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.h=
ref=3D'http://www.google.com/url?q\75http%3A%2F%2Fcmeerw.org\46sa\75D\4=
6sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4TmaRnGnQ';return true;" on=
click=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fcmeerw=
..org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4TmaRnGnQ';r=
eturn true;">cmeerw.org</a>
<br></blockquote></div></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_1300_1353911105.1441179712799--
------=_Part_1299_1786054117.1441179712798--
.
Author: Christof Meerwald <cmeerw@cmeerw.org>
Date: Wed, 2 Sep 2015 09:59:49 +0200
Raw View
On Wed, Sep 02, 2015 at 12:41:52AM -0700, Bengt Gustafsson wrote:
> @Cristof: I don't see the connection. AFAIK what is described in N2555
> currently is in the language, you can do this:
>
> template<template<typename...> TPL, typename... Us> class X<TPL<Us...>> {};
You could do that before N2555 already.
> What I was talking about is to be able to supply a variadic template class
> when a n-ary is asked for, basically. (And similarly one that has
> additional, but defaulted parameters).
Well, what you want to do is:
namespace ns1
{
template<template<typename> class TT>
struct A
{ };
template<typename ... T>
struct B
{ };
A<B> a;
}
And this is what N2555 says you can do at the moment (which is pretty
much the other way around of what you want):
namespace ns2
{
template<template<typename ...> class TT>
struct A
{ };
template<typename T>
struct B
{ };
A<B> a;
}
Christof
--
http://cmeerw.org sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Wed, 2 Sep 2015 18:14:52 -0700 (PDT)
Raw View
------=_Part_166_229370082.1441242892972
Content-Type: multipart/alternative;
boundary="----=_Part_167_193996057.1441242892973"
------=_Part_167_193996057.1441242892973
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Digression: notice that even under the current standard you cannot do *this=
*=20
variation:
namespace ns2=20
{=20
template<template<typename ...> class TT>=20
struct A=20
{ };=20
template<typename T, int J=3D0> // here I've added a non-type template=20
parameter with a default value
struct B=20
{ };=20
A<B> a; // fails to match
}
There has been discussion on this list within the past year of whether and=
=20
how to support "template parameters of unspecified kind"; whether template<=
auto=20
T> struct X should match both X<int> and X<1>, for example. This would let=
=20
metaprogrammers support things like
template<???> struct wrap { ... };
wrap<std::vector, int> wrapv;
wrap<std::vector, int, std::allocator<int>> wrapv;
wrap<std::array, int, 3> wrapa;
That seems of limited usefulness, admittedly.=20
=E2=80=93Arthur
On Wednesday, September 2, 2015 at 12:59:57 AM UTC-7, Christof Meerwald=20
wrote:
>
> On Wed, Sep 02, 2015 at 12:41:52AM -0700, Bengt Gustafsson wrote:=20
> > @Cristof: I don't see the connection. AFAIK what is described in N2555=
=20
> > currently is in the language, you can do this:=20
> >=20
> > template<template<typename...> TPL, typename... Us> class X<TPL<Us...>>=
=20
> {};=20
>
> You could do that before N2555 already.=20
>
> > What I was talking about is to be able to supply a variadic template=20
> class=20
> > when a n-ary is asked for, basically. (And similarly one that has=20
> > additional, but defaulted parameters).=20
>
> Well, what you want to do is:=20
>
> namespace ns1=20
> {=20
> template<template<typename> class TT>=20
> struct A=20
> { };=20
>
> template<typename ... T>=20
> struct B=20
> { };=20
>
> A<B> a;=20
> }=20
>
> And this is what N2555 says you can do at the moment (which is pretty=20
> much the other way around of what you want):=20
>
> namespace ns2=20
> {=20
> template<template<typename ...> class TT>=20
> struct A=20
> { };=20
>
> template<typename T>=20
> struct B=20
> { };=20
>
> A<B> a;=20
> }=20
>
>
> Christof=20
>
> --=20
>
> http://cmeerw.org sip:cmeerw at cmeerw.org=
=20
> mailto:cmeerw <javascript:> at cmeerw.org xmpp:cmeerw=
=20
> at cmeerw.org=20
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_167_193996057.1441242892973
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Digression: notice that even under the current standa=
rd you cannot do <i>this</i> variation:</div><div><br></div><div class=3D"p=
rettyprint" style=3D"background-color: rgb(250, 250, 250); border: 1px soli=
d rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">namespace</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> ns2 <br></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 </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">template</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">templ=
ate</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">...></span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> TT</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> <br>=C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> A <br>=C2=A0 </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">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
br><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">template</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
"><</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"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> J</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">=3D</span><span style=3D"color: #066;" class=3D=
"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// =
here I've added a non-type template parameter with a default value</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> B <br>=C2=A0 </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">};</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> <br><br>=C2=A0 A</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">B</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><font color=3D"#666600"><span style=3D"color: #800;" class=3D"s=
tyled-by-prettify">// fails to match</span></font><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span></div></code></div><br>There has been discussi=
on on this list within the past year of whether and how to support "te=
mplate parameters of unspecified kind"; whether <font face=3D"courier =
new, monospace">template<auto T> struct X</font>=C2=A0should match bo=
th X<int> and X<1>, for example. This would let metaprogrammers=
support things like<div><br></div><div class=3D"prettyprint" style=3D"back=
ground-color: rgb(250, 250, 250); border: 1px solid rgb(187, 187, 187); wor=
d-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypri=
nt"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><???></sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> wrap </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;" cla=
ss=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D"s=
tyled-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>wrap</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
<</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">vector</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> wrapv</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>wrap</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">st=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">vector</span><spa=
n 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">int</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">allocator</span><span style=3D"color: #080;" class=3D"styled-by-p=
rettify"><int></span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">></span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> wrapv</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>wrap<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">array</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: #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"styled-by-pretti=
fy"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">></span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> wrapa</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></span></div></code></div><di=
v><br>That seems of limited usefulness, admittedly.=C2=A0</div><div><br></d=
iv><div>=E2=80=93Arthur</div><div><br><br><br>On Wednesday, September 2, 20=
15 at 12:59:57 AM UTC-7, Christof Meerwald wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;">On Wed, Sep 02, 2015 at 12:41:52AM -0700, Bengt Gustafss=
on wrote:
<br>> @Cristof: I don't see the connection. AFAIK what is described =
in N2555=20
<br>> currently is in the language, you can do this:
<br>>=20
<br>> template<template<typename...> TPL, typename... Us> cl=
ass X<TPL<Us...>> {};
<br>
<br>You could do that before N2555 already.
<br>
<br>> What I was talking about is to be able to supply a variadic templa=
te class=20
<br>> when a n-ary is asked for, basically. (And similarly one that has=
=20
<br>> additional, but defaulted parameters).
<br>
<br>Well, what you want to do is:
<br>
<br>namespace ns1=20
<br>{
<br>=C2=A0 template<template<typename> class TT>
<br>=C2=A0 struct A
<br>=C2=A0 { };
<br>
<br>=C2=A0 template<typename ... T>
<br>=C2=A0 struct B
<br>=C2=A0 { };
<br>
<br>=C2=A0 A<B> a;
<br>}
<br>
<br>And this is what N2555 says you can do at the moment (which is pretty
<br>much the other way around of what you want):
<br>
<br>namespace ns2
<br>{
<br>=C2=A0 template<template<typename ...> class TT>
<br>=C2=A0 struct A
<br>=C2=A0 { };
<br>
<br>=C2=A0 template<typename T>
<br>=C2=A0 struct B
<br>=C2=A0 { };
<br>
<br>=C2=A0 A<B> a;
<br>}
<br>
<br>
<br>Christof
<br>
<br>--=20
<br>
<br><a href=3D"http://cmeerw.org" target=3D"_blank" rel=3D"nofollow" onmous=
edown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fcmeerw=
..org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4TmaRnGnQ';r=
eturn true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http=
%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4=
TmaRnGnQ';return true;">http://cmeerw.org</a> =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0sip:cmeerw at <a href=3D"http://cmeerw.org" target=3D"_blank" rel=3D"=
nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75htt=
p%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS=
4TmaRnGnQ';return true;" onclick=3D"this.href=3D'http://www.google.=
com/url?q\75http%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrP=
Znc6fRTa7r6eYuS4TmaRnGnQ';return true;">cmeerw.org</a>
<br>mailto:<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=
=3D"cnUpo8lpCAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascri=
pt:';return true;" onclick=3D"this.href=3D'javascript:';return =
true;">cmeerw</a> at <a href=3D"http://cmeerw.org" target=3D"_blank" rel=3D=
"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75ht=
tp%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYu=
S4TmaRnGnQ';return true;" onclick=3D"this.href=3D'http://www.google=
..com/url?q\75http%3A%2F%2Fcmeerw.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKr=
PZnc6fRTa7r6eYuS4TmaRnGnQ';return true;">cmeerw.org</a> =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 xmpp:cmeerw at <a href=3D"=
http://cmeerw.org" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.h=
ref=3D'http://www.google.com/url?q\75http%3A%2F%2Fcmeerw.org\46sa\75D\4=
6sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4TmaRnGnQ';return true;" on=
click=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fcmeerw=
..org\46sa\75D\46sntz\0751\46usg\75AFQjCNHKrPZnc6fRTa7r6eYuS4TmaRnGnQ';r=
eturn true;">cmeerw.org</a>
<br></blockquote></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_167_193996057.1441242892973--
------=_Part_166_229370082.1441242892972--
.