Topic: Extending using to support nested templates


Author: aary@umich.edu
Date: Wed, 15 Mar 2017 11:05:16 -0700 (PDT)
Raw View
------=_Part_14787_1967924077.1489601116615
Content-Type: multipart/alternative;
 boundary="----=_Part_14788_44195024.1489601116616"

------=_Part_14788_44195024.1489601116616
Content-Type: text/plain; charset=UTF-8

As of right now it is possible to define an alias to a nested template
class like so

template <typename TypeOne>
struct One {
    template <typename TypeTwo>
    struct type {};
};

template <typename TypeOne, typename TypeTwo>
using One_t = typename One<TypeOne>::template type<TypeTwo>;

Where if one wanted to use One<Type>::type<AnotherType> one could just do One_t<Type,
AnotherType>,  but it is not possible to define such an alias if the type
packs are variadic, for example

template <typename... Types>
struct Something {
    template <typename... TypesTwo>
    struct Another {};
};

template <typename... Types>
template <typename... TypesTwo>
using Something_t = typename Something<Types...>::template
Another<TypesTwo...>;

This no longer works, further with the approach above, one can also not use
the expression Something_t<TypeOne> as a template type by itself, the
language does not allow this, an alias cannot support more than one level
of templating.  Should using aliases be modified to support such syntax?
 If allowed one could use the alias in a nested manner like so

Something_t<TypeOne><TypeTwo>

because Something_t<TypeOne> would evaluate to a template type and then it
could be instantiated with another type from there on.

--
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/a700c7b9-d931-47e4-804a-e1ab7b7fa6f8%40isocpp.org.

------=_Part_14788_44195024.1489601116616
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">As of right now it is possible to define an alias to a nes=
ted template class like so=C2=A0<div><br></div><div><div><font face=3D"cour=
ier new, monospace">template &lt;typename TypeOne&gt;<br></font></div><div>=
<font face=3D"courier new, monospace">struct One {</font></div><div><font f=
ace=3D"courier new, monospace">=C2=A0 =C2=A0 template &lt;typename TypeTwo&=
gt;</font></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 st=
ruct type {};</font></div><div><font face=3D"courier new, monospace">};</fo=
nt></div><div><font face=3D"courier new, monospace"><br></font></div><div><=
font face=3D"courier new, monospace">template &lt;typename TypeOne, typenam=
e TypeTwo&gt;</font></div><div><font face=3D"courier new, monospace">using =
One_t =3D typename One&lt;TypeOne&gt;::template type&lt;TypeTwo&gt;;</font>=
</div></div><div><font face=3D"courier new, monospace"><br></font></div><di=
v><font face=3D"arial, sans-serif">Where if one wanted to use </font><font =
face=3D"courier new, monospace">One&lt;Type&gt;::type&lt;AnotherType&gt;</f=
ont><font face=3D"arial, sans-serif"> one could just do </font><font face=
=3D"courier new, monospace">One_t&lt;Type, AnotherType&gt;</font><font face=
=3D"arial, sans-serif">, =C2=A0but it is not possible to define such an ali=
as if the type packs are variadic, for example</font></div><div><font face=
=3D"arial, sans-serif"><br></font></div><div><div><font face=3D"courier new=
, monospace">template &lt;typename... Types&gt;<br></font></div><div><font =
face=3D"courier new, monospace">struct Something {</font></div><div><font f=
ace=3D"courier new, monospace">=C2=A0 =C2=A0 template &lt;typename... Types=
Two&gt;</font></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=
=A0 struct Another {};</font></div><div><font face=3D"courier new, monospac=
e">};</font></div><div><font face=3D"courier new, monospace"><br></font></d=
iv><div><font face=3D"courier new, monospace">template &lt;typename... Type=
s&gt;</font></div><div><font face=3D"courier new, monospace">template &lt;t=
ypename... TypesTwo&gt;</font></div><div><font face=3D"courier new, monospa=
ce">using Something_t =3D typename Something&lt;Types...&gt;::template Anot=
her&lt;TypesTwo...&gt;;</font></div><div><font face=3D"courier new, monospa=
ce"><br></font></div><div><font face=3D"arial, sans-serif">This no longer w=
orks, further with the approach above, one can also not use the expression =
</font><font face=3D"courier new, monospace">Something_t&lt;TypeOne&gt;</fo=
nt><font face=3D"arial, sans-serif"> as a template type by itself, the lang=
uage does not allow this, an alias cannot support more than one level of te=
mplating. =C2=A0Should </font><font face=3D"courier new, monospace">using</=
font><font face=3D"arial, sans-serif"> aliases be modified to support such =
syntax? =C2=A0If allowed one could use the alias in a nested manner like so=
=C2=A0</font></div></div><div><font face=3D"arial, sans-serif"><br></font><=
/div><div><font face=3D"courier new, monospace">Something_t&lt;TypeOne&gt;&=
lt;TypeTwo&gt;</font></div><div><font face=3D"arial, sans-serif"><br></font=
></div><div><font face=3D"arial, sans-serif">because </font><font face=3D"c=
ourier new, monospace">Something_t&lt;TypeOne&gt; </font><font face=3D"aria=
l, sans-serif">would evaluate to a template type and then it could be insta=
ntiated with another type from there on.=C2=A0</font></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/a700c7b9-d931-47e4-804a-e1ab7b7fa6f8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a700c7b9-d931-47e4-804a-e1ab7b7fa6f8=
%40isocpp.org</a>.<br />

------=_Part_14788_44195024.1489601116616--

------=_Part_14787_1967924077.1489601116615--

.


Author: Barry Revzin <barry.revzin@gmail.com>
Date: Wed, 15 Mar 2017 11:35:06 -0700 (PDT)
Raw View
------=_Part_15554_250053714.1489602906378
Content-Type: multipart/alternative;
 boundary="----=_Part_15555_224861790.1489602906378"

------=_Part_15555_224861790.1489602906378
Content-Type: text/plain; charset=UTF-8



On Wednesday, March 15, 2017 at 1:05:16 PM UTC-5, aa...@umich.edu wrote:
>
> This no longer works, further with the approach above, one can also not
> use the expression Something_t<TypeOne> as a template type by itself, the
> language does not allow this, an alias cannot support more than one level
> of templating.  Should using aliases be modified to support such syntax?
>  If allowed one could use the alias in a nested manner like so
>
> Something_t<TypeOne><TypeTwo>
>
> because Something_t<TypeOne> would evaluate to a template type and then
> it could be instantiated with another type from there on.
>

See discussion here:
https://groups.google.com/a/isocpp.org/forum/#!searchin/std-proposals/niebler/std-proposals/TN4LOt8iPas/EUXHF5OhBAAJ

--
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/62e71e52-7488-4a96-9212-4a4c40ae8a84%40isocpp.org.

------=_Part_15555_224861790.1489602906378
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, March 15, 2017 at 1:05:16 PM UTC-5, =
aa...@umich.edu wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><div><div><font face=3D"arial, sans-serif">This no longer works, f=
urther with the approach above, one can also not use the expression </font>=
<font face=3D"courier new, monospace">Something_t&lt;TypeOne&gt;</font><fon=
t face=3D"arial, sans-serif"> as a template type by itself, the language do=
es not allow this, an alias cannot support more than one level of templatin=
g. =C2=A0Should </font><font face=3D"courier new, monospace">using</font><f=
ont face=3D"arial, sans-serif"> aliases be modified to support such syntax?=
 =C2=A0If allowed one could use the alias in a nested manner like so=C2=A0<=
/font><br></div></div><div><font face=3D"arial, sans-serif"><br></font></di=
v><div><font face=3D"courier new, monospace">Something_t&lt;TypeOne&gt;&lt;=
TypeTwo&gt;</font></div><div><font face=3D"arial, sans-serif"><br></font></=
div><div><font face=3D"arial, sans-serif">because </font><font face=3D"cour=
ier new, monospace">Something_t&lt;TypeOne&gt; </font><font face=3D"arial, =
sans-serif">would evaluate to a template type and then it could be instanti=
ated with another type from there on.=C2=A0</font></div></div></blockquote>=
<div><br></div><div>See discussion here: https://groups.google.com/a/isocpp=
..org/forum/#!searchin/std-proposals/niebler/std-proposals/TN4LOt8iPas/EUXHF=
5OhBAAJ=C2=A0</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/62e71e52-7488-4a96-9212-4a4c40ae8a84%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/62e71e52-7488-4a96-9212-4a4c40ae8a84=
%40isocpp.org</a>.<br />

------=_Part_15555_224861790.1489602906378--

------=_Part_15554_250053714.1489602906378--

.


Author: aary@umich.edu
Date: Wed, 15 Mar 2017 11:56:19 -0700 (PDT)
Raw View
------=_Part_15610_1480373676.1489604179938
Content-Type: multipart/alternative;
 boundary="----=_Part_15611_1064903518.1489604179938"

------=_Part_15611_1064903518.1489604179938
Content-Type: text/plain; charset=UTF-8

The reason I stumbled upon this idea was while writing a Bind trait and
other meta-trait classes just like in the discussions there.

From the discussions there I feel like this is a reasonable thing to have,
and it would not introduce any conflicting behavior if a part of the
language, what should be done about this idea from this point on?

On Wednesday, March 15, 2017 at 2:35:06 PM UTC-4, Barry Revzin wrote:
>
>
>
> On Wednesday, March 15, 2017 at 1:05:16 PM UTC-5, aa...@umich.edu wrote:
>>
>> This no longer works, further with the approach above, one can also not
>> use the expression Something_t<TypeOne> as a template type by itself,
>> the language does not allow this, an alias cannot support more than one
>> level of templating.  Should using aliases be modified to support such
>> syntax?  If allowed one could use the alias in a nested manner like so
>>
>> Something_t<TypeOne><TypeTwo>
>>
>> because Something_t<TypeOne> would evaluate to a template type and then
>> it could be instantiated with another type from there on.
>>
>
> See discussion here:
> https://groups.google.com/a/isocpp.org/forum/#!searchin/std-proposals/niebler/std-proposals/TN4LOt8iPas/EUXHF5OhBAAJ
>
>

--
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/8de61b22-eb87-473b-bbb5-14fa36e8b222%40isocpp.org.

------=_Part_15611_1064903518.1489604179938
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The reason I stumbled upon this idea was while writing a B=
ind trait and other meta-trait classes just like in the discussions there. =
=C2=A0<div><br></div><div>From the discussions there I feel like this is a =
reasonable thing to have, and it would not introduce any conflicting behavi=
or if a part of the language, what should be done about this idea from this=
 point on? =C2=A0<div><br></div><div>On Wednesday, March 15, 2017 at 2:35:0=
6 PM UTC-4, Barry Revzin wrote:<blockquote class=3D"gmail_quote" style=3D"m=
argin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"=
><div dir=3D"ltr"><br><br>On Wednesday, March 15, 2017 at 1:05:16 PM UTC-5,=
 <a>aa...@umich.edu</a> wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr"><div><div><font face=3D"arial, sans-serif">This no longer works=
, further with the approach above, one can also not use the expression </fo=
nt><font face=3D"courier new, monospace">Something_t&lt;TypeOne&gt;</font><=
font face=3D"arial, sans-serif"> as a template type by itself, the language=
 does not allow this, an alias cannot support more than one level of templa=
ting. =C2=A0Should </font><font face=3D"courier new, monospace">using</font=
><font face=3D"arial, sans-serif"> aliases be modified to support such synt=
ax? =C2=A0If allowed one could use the alias in a nested manner like so=C2=
=A0</font><br></div></div><div><font face=3D"arial, sans-serif"><br></font>=
</div><div><font face=3D"courier new, monospace">Something_t&lt;TypeOne&gt;=
&lt;TypeTwo&gt;</font></div><div><font face=3D"arial, sans-serif"><br></fon=
t></div><div><font face=3D"arial, sans-serif">because </font><font face=3D"=
courier new, monospace">Something_t&lt;TypeOne&gt; </font><font face=3D"ari=
al, sans-serif">would evaluate to a template type and then it could be inst=
antiated with another type from there on.=C2=A0</font></div></div></blockqu=
ote><div><br></div><div>See discussion here: <a href=3D"https://groups.goog=
le.com/a/isocpp.org/forum/#!searchin/std-proposals/niebler/std-proposals/TN=
4LOt8iPas/EUXHF5OhBAAJ" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"t=
his.href=3D&#39;https://groups.google.com/a/isocpp.org/forum/#!searchin/std=
-proposals/niebler/std-proposals/TN4LOt8iPas/EUXHF5OhBAAJ&#39;;return true;=
" onclick=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/forum/=
#!searchin/std-proposals/niebler/std-proposals/TN4LOt8iPas/EUXHF5OhBAAJ&#39=
;;return true;">https://groups.google.com/a/<wbr>isocpp.org/forum/#!searchi=
n/<wbr>std-proposals/niebler/std-<wbr>proposals/TN4LOt8iPas/<wbr>EUXHF5OhBA=
AJ</a>=C2=A0</div></div></blockquote></div></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/8de61b22-eb87-473b-bbb5-14fa36e8b222%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8de61b22-eb87-473b-bbb5-14fa36e8b222=
%40isocpp.org</a>.<br />

------=_Part_15611_1064903518.1489604179938--

------=_Part_15610_1480373676.1489604179938--

.