Topic: Make Typedef Great Again
Author: TONGARI J <tongari95@gmail.com>
Date: Sun, 25 Dec 2016 23:38:47 -0800 (PST)
Raw View
------=_Part_1696_1228785115.1482737927673
Content-Type: multipart/alternative;
boundary="----=_Part_1697_126514692.1482737927674"
------=_Part_1697_126514692.1482737927674
Content-Type: text/plain; charset=UTF-8
Typedef declaration is superseded by type alias declaration since C++11,
its legend seems to come to the end. However, we can make typedef much more
useful than it is, by allowing it to be used in accompany with variable
declarations (including parameters and return types) and base-clause in a
class declaration.
The problem
Everyone who loves templates are likely to face a problem - the name of the
type being specified is too long that we don't want to spell it out twice!
Although we have type alias, but unfortunately in many cases, it cannot be
used at the first place and we are forced to spell the irritating names at
least twice if we have to refer to the type more than once.
Here are some examples:
In function return type:
template<blahblah...>
typename MetaFunc<blahblah...>::type f()
{
using T = typename MetaFunc<blahblah...>::type; // yuck!
// Use `T` from now on...
}
In base-clause:
template<blahblah...>
class Derived : public typename MetaFunc<blahblah...>::type
{
using Base = typename MetaFunc<blahblah...>::type; // yuck!
// Use `Base` from now on...
}
In parameter list:
template<blahblah...>
void f(SomeTemplate<blahblah...> a, SomeTemplate<blahblah...> b/*yuck!*/);
In deduced type:
auto& ref = getSomeRef(...);
using T = std::remove_reference_t<decltype(ref)>; // yuck!
// Use `T` from now on...
Evidence
These discussions on the std-proposals list are also arose from the same
problem:
- Named base classes
<https://groups.google.com/a/isocpp.org/d/topic/std-proposals/TKyHxlc--B8/discussion>
- decltype(return)
<https://groups.google.com/a/isocpp.org/d/topic/std-proposals/sfeZ_rR2BvQ/discussion>
The solution
The problem comes from the inability to declare the type alias at the first
place, and the solution is gonna to enable it - with the extended typedef.
In function return type:
template<blahblah...>
typedef typename MetaFunc<blahblah...>::type T f() // yay!
{
// Use `T` from now on...
}
In base-clause:
template<blahblah...>
class Derived : typedef public typename MetaFunc<blahblah...>::type Base //
yay!
{
// Use `Base` from now on...
}
Note how the occurrence of *access-specifier* in base-clause differ in
semantic:
class C : typedef T B // T: private base; B: private typedef
class C : typedef public T B // T: public base; B: private typedef
class C : public typedef T B // T: private base; B: public typedef
class C : public typedef public T B // T: public base; B: public typedef
In parameter list:
template<blahblah...>
void f(typedef SomeTemplate<blahblah...> T a, T b); // yay!
In deduced type:
typedef auto T& ref = getSomeRef(...); // yay!
// Use `T` from now on...
Note how the the type aliases declared differ:
U u;
typedef auto const& T1 t1 = u; // T1 -> U const&
typedef auto T2 const& t2 = u; // T2 -> U
Suppose we have Concept TS and its abbreviated template syntax, we can do
this:
void f1(typedef auto T a, T b);
void f2(typedef ConceptName T a, T b);
Typedef and tag declaration
If the typedef contains a tag declaration, the extended usage is disabled.
For example:
typedef struct {...} R f(); // ill-formed
void f(typedef struct {...} A a); // ill-formed
typedef struct {...} S s; // ill-formed
Extended typedef with mutiple indentifiers
If the extended typedef has mutiple indentifiers follw the typedef-name,
each identifier separated by , declares a variable. For example:
typedef int* P p1 = nullptr, p2 = nullptr, *p3 = nullptr; // p1 & p2 are
both `int*`, and p3 is `int**`
That's the rough idea I have, I haven't think about the technical aspect of
this approach.
Feedbacks are welcome!
--
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/cfbe556f-214a-4245-b257-f746424c63f2%40isocpp.org.
------=_Part_1697_126514692.1482737927674
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Typedef declaration is superseded by type alias decla=
ration since C++11, its legend seems to come to the end. However, we can ma=
ke <font face=3D"courier new, monospace">typedef</font>=C2=A0much more usef=
ul than it is, by allowing it to be used in accompany with variable declara=
tions (including parameters and return types) and base-clause in a class de=
claration.<br></div><div><br></div><div><font size=3D"6">The problem</font>=
</div><div><br></div><div>Everyone who loves templates are likely to face a=
problem - the name of the type being specified is too long that we don'=
;t want to spell it out twice!</div><div>Although we have type alias, but u=
nfortunately in many cases, it cannot be used at the first place and we are=
forced to spell the irritating names at least twice if we have to refer to=
the type more than once.</div><div>Here are some examples:</div><div><br><=
/div><div>In function return type:</div><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">template</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">blahblah</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"style=
d-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">MetaFunc</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">blah=
blah</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...>=
;::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">type f<=
/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 =C2=A0 </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> T </span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;"=
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"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">MetaFunc</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">blahblah</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
....>::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">t=
ype</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">// yuck!</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">// Use `T` from now=
on...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></=
div></code></div><div><br></div><div>In base-clause:</div><div class=3D"pre=
ttyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-wo=
rd;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">blahblah</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: #008;"=
class=3D"styled-by-prettify">class</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styl=
ed-by-prettify">Derived</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">public</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">MetaFunc</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify">blahblah</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">...>::</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">type<br></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Base</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #606;" class=3D"styled-by-prettify">MetaFunc</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">blahblah</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">...>::</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">type</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">// yuck!</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled=
-by-prettify">// Use `Base` from now on...</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">}</span></div></code></div><div><br></div><div>In=
parameter list:</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"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">blahblah</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">void</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #606;" class=3D"styled-by-prettify">SomeTemplate</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">blahblah</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">...></span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">SomeTemplate</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">blahblah</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">...></span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> b</span><span style=3D"color: #800;" class=3D"styled-by-prettify">/*yuck!=
*/</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span=
></div></code></div><div><br></div><div>In deduced type:</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: brea=
k-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">auto</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: #008;"=
class=3D"styled-by-prettify">ref</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> getSomeRef</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(...);</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">u=
sing</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">remove_reference_t</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">decltype</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">ref</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">)>;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">// yuck!</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">// Use `T` from now on...</span></div></code></div><div><br></div><div>=
<font size=3D"4">Evidence</font></div><div><font size=3D"4"><br></font></di=
v><div>These discussions on the std-proposals list are also arose from the =
same problem:</div><div><ul><li><a href=3D"https://groups.google.com/a/isoc=
pp.org/d/topic/std-proposals/TKyHxlc--B8/discussion">Named base classes</a>=
<br></li><li><a href=3D"https://groups.google.com/a/isocpp.org/d/topic/std-=
proposals/sfeZ_rR2BvQ/discussion">decltype(return)</a><br></li></ul></div><=
div><br></div><div><font size=3D"6">The solution</font></div><div><br></div=
><div>The problem comes from the inability to declare the type alias at the=
first place, and the solution is gonna to enable it - with the extended <f=
ont face=3D"courier new, monospace">typedef</font>.</div><div><br></div><di=
v>In function return type:</div><div class=3D"prettyprint" style=3D"backgro=
und-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-sty=
le: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pretty=
print"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"=
styled-by-prettify">template</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">blahblah</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">...></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>typedef</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFunc</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">blahblah</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...>::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">type T f</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: #800;"=
class=3D"styled-by-prettify">// yay!</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-b=
y-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"=
styled-by-prettify">// Use `T` from now on...</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">}</span></div></code></div><div><br></div><div=
>In base-clause:</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"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">blahblah</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">class</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">Derived</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #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">typedef</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">public</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
ypename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">MetaFunc</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">blahblah</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">...>::</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">type </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Base</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">// yay!</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"style=
d-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// Use `Base` from now on...</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">}</span></div></code></div><div><br></d=
iv><div>Note how the occurrence of <i>access-specifier</i>=C2=A0in base-cla=
use differ in semantic:</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"prettypri=
nt"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> C </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">typedef</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> T B </span><spa=
n style=3D"color: #800;" class=3D"styled-by-prettify">// T: private base; B=
: private typedef</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> C <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">typedef</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">public</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> T B </span><span style=3D"color: #800;" cla=
ss=3D"styled-by-prettify">// T: public base; B: private typedef</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> C </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">public</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">typedef</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> T B </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// T=
: private base; B: public typedef</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> C </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">public</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">typedef</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">public</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> T B </span><span style=3D"color: #800;" =
class=3D"styled-by-prettify">// T: public base; B: public typedef</span></d=
iv></code></div><div><br></div><div>In parameter list:</div><div class=3D"p=
rettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rg=
b(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-=
word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">blahblah</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: #008;"=
class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> f</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">typedef</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">SomeT=
emplate</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">blahblah<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">...></sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> T a</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T b</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// yay!</span></div></code></div><div><br></div><di=
v>In deduced type:</div><div class=3D"prettyprint" style=3D"background-colo=
r: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: soli=
d; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">typedef</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
auto</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><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">ref</span><span style=3D"col=
or: #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"> getSomeRef</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(...);</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">// yay!</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-prettif=
y">// Use `T` from now on...</span></div></code></div><div><br></div><div>N=
ote how the the type aliases declared differ:</div><div class=3D"prettyprin=
t" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 18=
7, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><c=
ode class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">U u</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"st=
yled-by-prettify">typedef</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> T1 t1 </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> u</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">// T1 -> U const&</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">typedef</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> T2 </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">const</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t2 <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> u</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: #800;=
" class=3D"styled-by-prettify">// T2 -> U</span></div></code></div><div>=
<br></div><div>Suppose we have Concept TS and its abbreviated template synt=
ax, we can do this:</div><div class=3D"prettyprint" style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; 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">void</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> f1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typedef</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> T a</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> T b</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"s=
tyled-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-pre=
ttify"> f2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typedef</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #606;" class=3D"styled-by-prettify">ConceptName</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> T a</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> T b</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">);</span></div></code></div><div><br></di=
v><div><br></div><div><font size=3D"4">Typedef and tag declaration</font></=
div><div><br></div><div>If the <font face=3D"courier new, monospace">typede=
f</font>=C2=A0contains a tag declaration, the extended usage is disabled. F=
or example:</div><div class=3D"prettyprint" style=3D"background-color: rgb(=
250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bord=
er-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div cla=
ss=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">typedef</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"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{...}</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> R f</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: #800;" c=
lass=3D"styled-by-prettify">// ill-formed</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> f</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">typedef</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</sp=
an><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"> A a</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// ill-formed</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">typedef</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{...=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> S s</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: #800;" class=3D"styled-by-prettify">// ill-formed</span></div></code>=
</div><div><br></div><div><br></div><div><font size=3D"4">Extended typedef =
with mutiple indentifiers</font></div><div><br></div><div>If the extended t=
ypedef has mutiple indentifiers follw the typedef-name, each identifier sep=
arated by <font face=3D"courier new, monospace" color=3D"#000000" style=3D"=
background-color: rgb(204, 204, 204);">,</font>=C2=A0declares a variable. F=
or example:</div><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"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">typedef</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">in=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> P p1 </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">nullptr</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> p2 </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">nullptr</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 sty=
le=3D"color: #000;" class=3D"styled-by-prettify">p3 </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">nullptr</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: #800;" class=3D"styled-by-pret=
tify">// p1 & p2 are both `int*`, and p3 is `int**`</span></div></code>=
</div></div><div><br></div><div><br></div><div>That's the rough idea I =
have, I haven't think about the technical aspect of this approach.</div=
><div>Feedbacks are welcome!</div></div>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/cfbe556f-214a-4245-b257-f746424c63f2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cfbe556f-214a-4245-b257-f746424c63f2=
%40isocpp.org</a>.<br />
------=_Part_1697_126514692.1482737927674--
------=_Part_1696_1228785115.1482737927673--
.
Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Sun, 5 Feb 2017 02:03:45 -0800 (PST)
Raw View
------=_Part_893_1943674408.1486289025814
Content-Type: multipart/alternative;
boundary="----=_Part_894_1115334187.1486289025816"
------=_Part_894_1115334187.1486289025816
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I like it, but it does take some getting used to the stacking of=20
identifiers in parameter and variable declaration cases. Also, in these=20
cases, I suspect there could be some parsing issues, especially if the name=
=20
of the type is defined in an outer scope. Maybe you'd have to
clarify why this is not a problem. Then again, I can't really produce a=20
problematic example so maybe I'm just seeing ghosts here. However, an=20
example involving an array size bracket would be interesting as it comes=20
after the identifier. This brings up a wrinkle in the last example:
typedef int* P p1 =3D nullptr, p2 =3D nullptr, *p3 =3D nullptr; // p1 & p2 =
are=20
both `int*`, and p3 is `int**`
Here you must make it clear that there is a new rule in play compared to=20
what would be the most logical interpretation compared to current language=
=20
rules: That the * would only apply to the next identifier being declared.=
=20
Instead the new rule is as you explain, which is necessary for the use case=
=20
of return type.
Den m=C3=A5ndag 26 december 2016 kl. 08:38:48 UTC+1 skrev TONGARI J:
>
> Typedef declaration is superseded by type alias declaration since C++11,=
=20
> its legend seems to come to the end. However, we can make typedef much=20
> more useful than it is, by allowing it to be used in accompany with=20
> variable declarations (including parameters and return types) and=20
> base-clause in a class declaration.
>
> The problem
>
> Everyone who loves templates are likely to face a problem - the name of=
=20
> the type being specified is too long that we don't want to spell it out=
=20
> twice!
> Although we have type alias, but unfortunately in many cases, it cannot b=
e=20
> used at the first place and we are forced to spell the irritating names a=
t=20
> least twice if we have to refer to the type more than once.
> Here are some examples:
>
> In function return type:
> template<blahblah...>
> typename MetaFunc<blahblah...>::type f()
> {
> using T =3D typename MetaFunc<blahblah...>::type; // yuck!
> // Use `T` from now on...
> }
>
> In base-clause:
> template<blahblah...>
> class Derived : public typename MetaFunc<blahblah...>::type
> {
> using Base =3D typename MetaFunc<blahblah...>::type; // yuck!
> // Use `Base` from now on...
> }
>
> In parameter list:
> template<blahblah...>
> void f(SomeTemplate<blahblah...> a, SomeTemplate<blahblah...> b/*yuck!*/)=
;
>
> In deduced type:
> auto& ref =3D getSomeRef(...);
> using T =3D std::remove_reference_t<decltype(ref)>; // yuck!
> // Use `T` from now on...
>
> Evidence
>
> These discussions on the std-proposals list are also arose from the same=
=20
> problem:
>
> - Named base classes=20
> <https://groups.google.com/a/isocpp.org/d/topic/std-proposals/TKyHxlc-=
-B8/discussion>
> - decltype(return)=20
> <https://groups.google.com/a/isocpp.org/d/topic/std-proposals/sfeZ_rR2=
BvQ/discussion>
> =20
>
> The solution
>
> The problem comes from the inability to declare the type alias at the=20
> first place, and the solution is gonna to enable it - with the extended=
=20
> typedef.
>
> In function return type:
> template<blahblah...>
> typedef typename MetaFunc<blahblah...>::type T f() // yay!
> {
> // Use `T` from now on...
> }
>
> In base-clause:
> template<blahblah...>
> class Derived : typedef public typename MetaFunc<blahblah...>::type Base =
//=20
> yay!
> {
> // Use `Base` from now on...
> }
>
> Note how the occurrence of *access-specifier* in base-clause differ in=20
> semantic:
> class C : typedef T B // T: private base; B: private typedef
> class C : typedef public T B // T: public base; B: private typedef
> class C : public typedef T B // T: private base; B: public typedef
> class C : public typedef public T B // T: public base; B: public typedef
>
> In parameter list:
> template<blahblah...>
> void f(typedef SomeTemplate<blahblah...> T a, T b); // yay!
>
> In deduced type:
> typedef auto T& ref =3D getSomeRef(...); // yay!
> // Use `T` from now on...
>
> Note how the the type aliases declared differ:
> U u;
> typedef auto const& T1 t1 =3D u; // T1 -> U const&
> typedef auto T2 const& t2 =3D u; // T2 -> U
>
> Suppose we have Concept TS and its abbreviated template syntax, we can do=
=20
> this:
> void f1(typedef auto T a, T b);
> void f2(typedef ConceptName T a, T b);
>
>
> Typedef and tag declaration
>
> If the typedef contains a tag declaration, the extended usage is=20
> disabled. For example:
> typedef struct {...} R f(); // ill-formed
> void f(typedef struct {...} A a); // ill-formed
> typedef struct {...} S s; // ill-formed
>
>
> Extended typedef with mutiple indentifiers
>
> If the extended typedef has mutiple indentifiers follw the typedef-name,=
=20
> each identifier separated by , declares a variable. For example:
> typedef int* P p1 =3D nullptr, p2 =3D nullptr, *p3 =3D nullptr; // p1 & p=
2 are=20
> both `int*`, and p3 is `int**`
>
>
> That's the rough idea I have, I haven't think about the technical aspect=
=20
> of this approach.
> Feedbacks are welcome!
>
--=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/cd4db888-d877-4249-91f6-cfacda0a2afe%40isocpp.or=
g.
------=_Part_894_1115334187.1486289025816
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I like it, but it does take some getting used to the stack=
ing of identifiers in parameter and variable declaration cases. Also, in th=
ese cases, I suspect there could be some parsing issues, especially if the =
name of the type is defined in an outer scope. Maybe you'd have to<div>=
clarify why this is not a problem. Then again, I can't really produce a=
problematic example so maybe I'm just seeing ghosts here. However, an =
example involving an array size bracket would be interesting as it comes af=
ter the identifier. This brings up a wrinkle in the last example:</div><div=
><br></div><div><div><div style=3D"border-width: 1px; border-style: solid; =
border-color: rgb(187, 187, 187); background-color: rgb(250, 250, 250); wor=
d-wrap: break-word;"><code><span style=3D"color: rgb(0, 0, 136);">typedef</=
span><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color=
: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(102, 102, 0);">*</sp=
an><span style=3D"color: rgb(0, 0, 0);">=C2=A0P p1=C2=A0</span><span style=
=3D"color: rgb(102, 102, 0);">=3D</span><span style=3D"color: rgb(0, 0, 0);=
">=C2=A0</span><span style=3D"color: rgb(0, 0, 136);">nullptr</span><span s=
tyle=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0=
);">=C2=A0p2=C2=A0</span><span style=3D"color: rgb(102, 102, 0);">=3D</span=
><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: rg=
b(0, 0, 136);">nullptr</span><span style=3D"color: rgb(102, 102, 0);">,</sp=
an><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: =
rgb(102, 102, 0);">*</span><span style=3D"color: rgb(0, 0, 0);">p3=C2=A0</s=
pan><span style=3D"color: rgb(102, 102, 0);">=3D</span><span style=3D"color=
: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: rgb(0, 0, 136);">nullpt=
r</span><span style=3D"color: rgb(102, 102, 0);">;</span><span style=3D"col=
or: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: rgb(136, 0, 0);">// p=
1 & p2 are both `int*`, and p3 is `int**`</span></code></div></div><div=
><code><span style=3D"color: rgb(136, 0, 0);"><br></span></code></div><div>=
<font color=3D"#880000" face=3D"monospace">Here you must make it clear that=
there is a new rule in play compared to what would be the most logical int=
erpretation compared to current language rules: That the * would only apply=
to the next identifier being declared. Instead the new rule is as you expl=
ain, which is necessary for the use case of return type.</font></div><div><=
br><br>Den m=C3=A5ndag 26 december 2016 kl. 08:38:48 UTC+1 skrev TONGARI J:=
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>Typedef =
declaration is superseded by type alias declaration since C++11, its legend=
seems to come to the end. However, we can make <font face=3D"courier new, =
monospace">typedef</font>=C2=A0much more useful than it is, by allowing it =
to be used in accompany with variable declarations (including parameters an=
d return types) and base-clause in a class declaration.<br></div><div><br><=
/div><div><font size=3D"6">The problem</font></div><div><br></div><div>Ever=
yone who loves templates are likely to face a problem - the name of the typ=
e being specified is too long that we don't want to spell it out twice!=
</div><div>Although we have type alias, but unfortunately in many cases, it=
cannot be used at the first place and we are forced to spell the irritatin=
g names at least twice if we have to refer to the type more than once.</div=
><div>Here are some examples:</div><div><br></div><div>In function return t=
ype:</div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(=
187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><cod=
e><div><span style=3D"color:#008">template</span><span style=3D"color:#660"=
><</span><span style=3D"color:#000">blahblah</span><span style=3D"color:=
#660">...></span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#008">typename</span><span style=3D"color:#000"> </span><span style=3D"=
color:#606">MetaFunc</span><span style=3D"color:#660"><</span><span styl=
e=3D"color:#000">blahblah</span><span style=3D"color:#660">...>::</span>=
<span style=3D"color:#000">type f</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:#00=
8">using</span><span style=3D"color:#000"> T </span><span style=3D"color:#6=
60">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>typename</span><span style=3D"color:#000"> </span><span style=3D"color:#60=
6">MetaFunc</span><span style=3D"color:#660"><</span><span style=3D"colo=
r:#000">blahblah</span><span style=3D"color:#660">...>::</span><span sty=
le=3D"color:#000">type</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#800">// yuck!</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">// Us=
e `T` from now on...</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#660">}</span></div></code></div><div><br></div><div>In base-cla=
use:</div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(=
187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><cod=
e><div><span style=3D"color:#008">template</span><span style=3D"color:#660"=
><</span><span style=3D"color:#000">blahblah</span><span style=3D"color:=
#660">...></span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#008">class</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#606">Derived</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#660">:</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">public</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">typename</span><span style=3D"color:#000"> </span><span style=3D"color=
:#606">MetaFunc</span><span style=3D"color:#660"><</span><span style=3D"=
color:#000">blahblah</span><span style=3D"color:#660">...>::</span><span=
style=3D"color:#000">type<br></span><span style=3D"color:#660">{</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008"=
>using</span><span style=3D"color:#000"> </span><span style=3D"color:#606">=
Base</span><span style=3D"color:#000"> </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typ=
ename</span><span style=3D"color:#000"> </span><span style=3D"color:#606">M=
etaFunc</span><span style=3D"color:#660"><</span><span style=3D"color:#0=
00">blahblah</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">// yuck!</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#800">// Us=
e `Base` from now on...</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#660">}</span></div></code></div><div><br></div><div>In param=
eter list:</div><div style=3D"background-color:rgb(250,250,250);border-colo=
r:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word=
"><code><div><span style=3D"color:#008">template</span><span style=3D"color=
:#660"><</span><span style=3D"color:#000">blahblah</span><span style=3D"=
color:#660">...></span><span style=3D"color:#000"><br></span><span style=
=3D"color:#008">void</span><span style=3D"color:#000"> f</span><span style=
=3D"color:#660">(</span><span style=3D"color:#606">SomeTemplate</span><span=
style=3D"color:#660"><</span><span style=3D"color:#000">blahblah</span>=
<span style=3D"color:#660">...></span><span style=3D"color:#000"> a</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#606">SomeTemplate</span><span style=3D"color:#660"><<=
/span><span style=3D"color:#000">blahblah</span><span style=3D"color:#660">=
....></span><span style=3D"color:#000"> b</span><span style=3D"color:#800=
">/*yuck!*/</span><span style=3D"color:#660">);</span></div></code></div><d=
iv><br></div><div>In deduced type:</div><div style=3D"background-color:rgb(=
250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:=
1px;word-wrap:break-word"><code><div><span style=3D"color:#008">auto</span>=
<span style=3D"color:#660">&</span><span style=3D"color:#000"> </span><=
span style=3D"color:#008">ref</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#660">=3D</span><span style=3D"color:#000"> getSomeRef</sp=
an><span style=3D"color:#660">(...);</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#008">using</span><span style=3D"color:#000"> T =
</span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> std=
</span><span style=3D"color:#660">::</span><span style=3D"color:#000">remov=
e_reference_t</span><span style=3D"color:#660"><</span><span style=3D"co=
lor:#008">declty<wbr>pe</span><span style=3D"color:#660">(</span><span styl=
e=3D"color:#008">ref</span><span style=3D"color:#660">)>;</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#800">// yuck!</span><span =
style=3D"color:#000"><br></span><span style=3D"color:#800">// Use `T` from =
now on...</span></div></code></div><div><br></div><div><font size=3D"4">Evi=
dence</font></div><div><font size=3D"4"><br></font></div><div>These discuss=
ions on the std-proposals list are also arose from the same problem:</div><=
div><ul><li><a href=3D"https://groups.google.com/a/isocpp.org/d/topic/std-p=
roposals/TKyHxlc--B8/discussion" target=3D"_blank" rel=3D"nofollow" onmouse=
down=3D"this.href=3D'https://groups.google.com/a/isocpp.org/d/topic/std=
-proposals/TKyHxlc--B8/discussion';return true;" onclick=3D"this.href=
=3D'https://groups.google.com/a/isocpp.org/d/topic/std-proposals/TKyHxl=
c--B8/discussion';return true;">Named base classes</a><br></li><li><a h=
ref=3D"https://groups.google.com/a/isocpp.org/d/topic/std-proposals/sfeZ_rR=
2BvQ/discussion" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.hre=
f=3D'https://groups.google.com/a/isocpp.org/d/topic/std-proposals/sfeZ_=
rR2BvQ/discussion';return true;" onclick=3D"this.href=3D'https://gr=
oups.google.com/a/isocpp.org/d/topic/std-proposals/sfeZ_rR2BvQ/discussion&#=
39;;return true;">decltype(return)</a><br></li></ul></div><div><br></div><d=
iv><font size=3D"6">The solution</font></div><div><br></div><div>The proble=
m comes from the inability to declare the type alias at the first place, an=
d the solution is gonna to enable it - with the extended <font face=3D"cour=
ier new, monospace">typedef</font>.</div><div><br></div><div>In function re=
turn type:</div><div style=3D"background-color:rgb(250,250,250);border-colo=
r:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word=
"><code><div><span style=3D"color:#008">template</span><span style=3D"color=
:#660"><</span><span style=3D"color:#000">blahblah</span><span style=3D"=
color:#660">...></span><span style=3D"color:#000"><br></span><span style=
=3D"color:#008">typedef</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#008">typename</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">MetaFunc</span><span style=3D"color:#660"><</span><sp=
an style=3D"color:#000">blahblah</span><span style=3D"color:#660">...>::=
</span><span style=3D"color:#000">type T f</span><span style=3D"color:#660"=
>()</span><span style=3D"color:#000"> </span><span style=3D"color:#800">// =
yay!</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:#800">// Use `T` from now on...</span><span style=3D"color:#000"><br=
></span><span style=3D"color:#660">}</span></div></code></div><div><br></di=
v><div>In base-clause:</div><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"><</span><span style=3D"color:#000">blahblah</span><sp=
an style=3D"color:#660">...></span><span style=3D"color:#000"><br></span=
><span style=3D"color:#008">class</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#606">Derived</span><span style=3D"color:#000"> </span=
><span style=3D"color:#660">:</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">typedef</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#008">public</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#008">typename</span><span style=3D"color:#000"> </span><=
span style=3D"color:#606">MetaFunc</span><span style=3D"color:#660"><</s=
pan><span style=3D"color:#000">blahblah</span><span style=3D"color:#660">..=
..>::</span><span style=3D"color:#000">type </span><span style=3D"color:#=
606">Base</span><span style=3D"color:#000"> </span><span style=3D"color:#80=
0">// yay!</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 st=
yle=3D"color:#800">// Use `Base` from now on...</span><span style=3D"color:=
#000"><br></span><span style=3D"color:#660">}</span></div></code></div><div=
><br></div><div>Note how the occurrence of <i>access-specifier</i>=C2=A0in =
base-clause differ in semantic:</div><div style=3D"background-color:rgb(250=
,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px=
;word-wrap:break-word"><code><div><span style=3D"color:#008">class</span><s=
pan style=3D"color:#000"> C </span><span style=3D"color:#660">:</span><span=
style=3D"color:#000"> </span><span style=3D"color:#008">typedef</span><spa=
n style=3D"color:#000"> T B </span><span style=3D"color:#800">// T: private=
base; B: private typedef</span><span style=3D"color:#000"><br></span><span=
style=3D"color:#008">class</span><span style=3D"color:#000"> C </span><spa=
n style=3D"color:#660">:</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">typedef</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">public</span><span style=3D"color:#000"> T B </span><spa=
n style=3D"color:#800">// T: public base; B: private typedef</span><span st=
yle=3D"color:#000"><br></span><span style=3D"color:#008">class</span><span =
style=3D"color:#000"> C </span><span style=3D"color:#660">:</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">public</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">typedef</span><span st=
yle=3D"color:#000"> T B </span><span style=3D"color:#800">// T: private bas=
e; B: public typedef</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> C </span><span sty=
le=3D"color:#660">:</span><span style=3D"color:#000"> </span><span style=3D=
"color:#008">public</span><span style=3D"color:#000"> </span><span style=3D=
"color:#008">typedef</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">public</span><span style=3D"color:#000"> T B </span><span s=
tyle=3D"color:#800">// T: public base; B: public typedef</span></div></code=
></div><div><br></div><div>In parameter list:</div><div style=3D"background=
-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bo=
rder-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">=
template</span><span style=3D"color:#660"><</span><span style=3D"color:#=
000">blahblah</span><span style=3D"color:#660">...></span><span style=3D=
"color:#000"><br></span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> f</span><span style=3D"color:#660">(</span><span style=3D"=
color:#008">typedef</span><span style=3D"color:#000"> </span><span style=3D=
"color:#606">SomeTemplate</span><span style=3D"color:#660"><</span><span=
style=3D"color:#000">blahblah</span><span style=3D"color:#660">...></sp=
an><span style=3D"color:#000"> T a</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> T b</span><span style=3D"color:#660">);</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#800">// yay!</span=
></div></code></div><div><br></div><div>In deduced type:</div><div style=3D=
"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-sty=
le:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"c=
olor:#008">typedef</span><span style=3D"color:#000"> </span><span style=3D"=
color:#008">auto</span><span style=3D"color:#000"> T</span><span style=3D"c=
olor:#660">&</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#008">ref</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">=3D</span><span style=3D"color:#000"> getSomeRef</span><span style=
=3D"color:#660">(...);</span><span style=3D"color:#000"> </span><span style=
=3D"color:#800">// yay!</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#800">// Use `T` from now on...</span></div></code></div><div=
><br></div><div>Note how the the type aliases declared differ:</div><div st=
yle=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bord=
er-style:solid;border-width:1px;word-wrap:break-word"><code><div><span styl=
e=3D"color:#000">U u</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">typedef</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#008">auto</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">const</span><span styl=
e=3D"color:#660">&</span><span style=3D"color:#000"> T1 t1 </span><span=
style=3D"color:#660">=3D</span><span style=3D"color:#000"> u</span><span s=
tyle=3D"color:#660">;</span><span style=3D"color:#000"> </span><span style=
=3D"color:#800">// T1 -> U const&</span><span style=3D"color:#000"><=
br></span><span style=3D"color:#008">typedef</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">auto</span><span style=3D"color:#000"=
> T2 </span><span style=3D"color:#008">const</span><span style=3D"color:#66=
0">&</span><span style=3D"color:#000"> t2 </span><span style=3D"color:#=
660">=3D</span><span style=3D"color:#000"> u</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"> </span><span style=3D"color:#800">//=
T2 -> U</span></div></code></div><div><br></div><div>Suppose we have Co=
ncept TS and its abbreviated template syntax, we can do this:</div><div sty=
le=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);borde=
r-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#008">void</span><span style=3D"color:#000"> f1</span><span style=
=3D"color:#660">(</span><span style=3D"color:#008">typedef</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#008">auto</span><span style=
=3D"color:#000"> T a</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> T b</span><span style=3D"color:#660">);</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">void</span><span styl=
e=3D"color:#000"> f2</span><span style=3D"color:#660">(</span><span style=
=3D"color:#008">typedef</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#606">ConceptName</span><span style=3D"color:#000"> T a</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> T b</span><spa=
n style=3D"color:#660">);</span></div></code></div><div><br></div><div><br>=
</div><div><font size=3D"4">Typedef and tag declaration</font></div><div><b=
r></div><div>If the <font face=3D"courier new, monospace">typedef</font>=C2=
=A0contains a tag declaration, the extended usage is disabled. For example:=
</div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,=
187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><d=
iv><span style=3D"color:#008">typedef</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">struct</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">{...}</span><span style=3D"color:#000"> R f<=
/span><span style=3D"color:#660">();</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#800">// ill-formed</span><span style=3D"color:#000=
"><br></span><span style=3D"color:#008">void</span><span style=3D"color:#00=
0"> f</span><span style=3D"color:#660">(</span><span style=3D"color:#008">t=
ypedef</span><span style=3D"color:#000"> </span><span style=3D"color:#008">=
struct</span><span style=3D"color:#000"> </span><span style=3D"color:#660">=
{...}</span><span style=3D"color:#000"> A a</span><span style=3D"color:#660=
">);</span><span style=3D"color:#000"> </span><span style=3D"color:#800">//=
ill-formed</span><span style=3D"color:#000"><br></span><span style=3D"colo=
r:#008">typedef</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#008">struct</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{...}</span><span style=3D"color:#000"> S s</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"> </span><span style=3D"color:=
#800">// ill-formed</span></div></code></div><div><br></div><div><br></div>=
<div><font size=3D"4">Extended typedef with mutiple indentifiers</font></di=
v><div><br></div><div>If the extended typedef has mutiple indentifiers foll=
w the typedef-name, each identifier separated by <font face=3D"courier new,=
monospace" color=3D"#000000" style=3D"background-color:rgb(204,204,204)">,=
</font>=C2=A0declares a variable. For example:</div><div><div style=3D"back=
ground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:so=
lid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:=
#008">typedef</span><span style=3D"color:#000"> </span><span style=3D"color=
:#008">int</span><span style=3D"color:#660">*</span><span style=3D"color:#0=
00"> P p1 </span><span style=3D"color:#660">=3D</span><span style=3D"color:=
#000"> </span><span style=3D"color:#008">nullptr</span><span style=3D"color=
:#660">,</span><span style=3D"color:#000"> p2 </span><span style=3D"color:#=
660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">nullptr</span><span style=3D"color:#660">,</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#660">*</span><span style=3D"color:#000">p3=
</span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </=
span><span style=3D"color:#008">nullptr</span><span style=3D"color:#660">;<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#800">// p1 &=
amp; p2 are both `int*`, and p3 is `int**`</span></div></code></div></div><=
div><br></div><div><br></div><div>That's the rough idea I have, I haven=
't think about the technical aspect of this approach.</div><div>Feedbac=
ks are welcome!</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" 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/cd4db888-d877-4249-91f6-cfacda0a2afe%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cd4db888-d877-4249-91f6-cfacda0a2afe=
%40isocpp.org</a>.<br />
------=_Part_894_1115334187.1486289025816--
------=_Part_893_1943674408.1486289025814--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Sun, 5 Feb 2017 11:41:32 +0100
Raw View
This is a multi-part message in MIME format.
--------------5CA4DAA407AE010D0050BCCF
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 26/12/2016 =C3=A0 08:38, TONGARI J a =C3=A9crit :
> Typedef declaration is superseded by type alias declaration since=20
> C++11, its legend seems to come to the end. However, we can make=20
> typedef much more useful than it is, by allowing it to be used in=20
> accompany with variable declarations (including parameters and return=20
> types) and base-clause in a class declaration.
>
> The problem
>
> Everyone who loves templates are likely to face a problem - the name=20
> of the type being specified is too long that we don't want to spell it=20
> out twice!
> Although we have type alias, but unfortunately in many cases, it=20
> cannot be used at the first place and we are forced to spell the=20
> irritating names at least twice if we have to refer to the type more=20
> than once.
> Here are some examples:
>
> In function return type:
> |
> template<blahblah...>
> typenameMetaFunc<blahblah...>::type f()
> {
> usingT =3DtypenameMetaFunc<blahblah...>::type;// yuck!
> // Use `T` from now on...
> }
> |
>
> In base-clause:
> |
> template<blahblah...>
> classDerived:publictypenameMetaFunc<blahblah...>::type
> {
> usingBase=3DtypenameMetaFunc<blahblah...>::type;// yuck!
> // Use `Base` from now on...
> }
> |
>
> In parameter list:
> |
> template<blahblah...>
> voidf(SomeTemplate<blahblah...>a,SomeTemplate<blahblah...>b/*yuck!*/);
> |
>
> In deduced type:
> |
> auto&ref=3DgetSomeRef(...);
> usingT =3Dstd::remove_reference_t<decltype(ref)>;// yuck!
> // Use `T` from now on...
> |
>
> Evidence
>
> These discussions on the std-proposals list are also arose from the=20
> same problem:
>
> * Named base classes
> <https://groups.google.com/a/isocpp.org/d/topic/std-proposals/TKyHxlc=
--B8/discussion>
> * decltype(return)
> <https://groups.google.com/a/isocpp.org/d/topic/std-proposals/sfeZ_rR=
2BvQ/discussion>
>
>
> The solution
>
> The problem comes from the inability to declare the type alias at the=20
> first place, and the solution is gonna to enable it - with the=20
> extended typedef.
>
> In function return type:
> |
> template<blahblah...>
> typedeftypenameMetaFunc<blahblah...>::type T f()// yay!
> {
> // Use `T` from now on...
> }
> |
>
I'm not saying the feature is not needed. I believe however that the=20
proposal needs to compare what it is currently doable.
Couldn't we use the existing language already
|
template<blahblah..., typename T =3D |typenameMetaFunc<blahblah...>::type |=
>
T f()// yay!
{
// Use `T` from now on...
}
|
> In base-clause:
> |
> template<blahblah...>
> classDerived:typedefpublictypenameMetaFunc<blahblah...>::type Base// yay!
> {
> // Use `Base` from now on...
> }
> |
>
|
template<blahblah..., typename Base=3D|typenameMetaFunc<blahblah...>::type|=
>
classDerived:publicBase// yay!
{
// Use `Base` from now on...
}
|
> Note how the occurrence of /access-specifier/ in base-clause differ in=20
> semantic:
> |
> classC :typedefT B // T: private base; B: private typedef
> classC :typedefpublicT B // T: public base; B: private typedef
> classC :publictypedefT B // T: private base; B: public typedef
> classC :publictypedefpublicT B // T: public base; B: public typedef
> |
>
> In parameter list:
> |
> template<blahblah...>
> voidf(typedefSomeTemplate<blahblah...>T a,T b);// yay!
> |
>
I'm not sure the |blahblahcould be inferred
Do tou mean
|
|template<class U>
voidf(U, typedefSomeTemplate<U>T a,T b);
If it is the case
|
||template<class U, class T =3D ||||||SomeTemplate<U>|| >
voidf(U, T a,T b);
See |http://melpon.org/wandbox/permlink/FBlKcQZwxAs5ZJRT
|
> In deduced type:
I have not alternative to this with the current language :(
Vicente
--=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/b1ae66d2-da65-bd04-6ac0-8bed1d13c5c5%40wanadoo.f=
r.
--------------5CA4DAA407AE010D0050BCCF
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 26/12/2016 =C3=A0 08:38, TONGARI J a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:cfbe556f-214a-4245-b257-f746424c63f2@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>Typedef declaration is superseded by type alias declaration
since C++11, its legend seems to come to the end. However, we
can make <font face=3D"courier new, monospace">typedef</font>=C2=
=A0much
more useful than it is, by allowing it to be used in accompany
with variable declarations (including parameters and return
types) and base-clause in a class declaration.<br>
</div>
<div><br>
</div>
<div><font size=3D"6">The problem</font></div>
<div><br>
</div>
<div>Everyone who loves templates are likely to face a problem -
the name of the type being specified is too long that we don't
want to spell it out twice!</div>
<div>Although we have type alias, but unfortunately in many
cases, it cannot be used at the first place and we are forced
to spell the irritating names at least twice if we have to
refer to the type more than once.</div>
<div>Here are some examples:</div>
<div><br>
</div>
<div>In function return type:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</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">typename</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type f<=
/span><span
style=3D"color: #660;" class=3D"styled-by-prettify">()</spa=
n><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"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #008;"
class=3D"styled-by-prettify">using</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T </sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type</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: #800;" class=3D"styled-by-prettify">// yuck=
!</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `T` from now on...</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">}</span></div>
</code></div>
<div><br>
</div>
<div>In base-clause:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</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">class</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">Derived=
</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"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">public<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type<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 =C2=A0 </span><span style=3D"color: #008;"
class=3D"styled-by-prettify">using</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">Base</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type</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: #800;" class=3D"styled-by-prettify">// yuck=
!</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `Base` from now on...</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">}</span></div>
</code></div>
<div><br>
</div>
<div>In parameter list:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</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">void</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> f</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">SomeTem=
plate</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> a</spa=
n><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: #606;" class=3D"styled-by-prettify">SomeTem=
plate</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> b</spa=
n><span
style=3D"color: #800;" class=3D"styled-by-prettify">/*yuck!=
*/</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">);</spa=
n></div>
</code></div>
<div><br>
</div>
<div>In deduced type:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">auto</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">ref</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify">
getSomeRef</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">using</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T </sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify">remove_=
reference_t</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #008;" class=3D"styled-by-prettify">decltyp=
e</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">ref</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: #800;" class=3D"styled-by-prettify">// yuck=
!</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `T` from now on...</spa=
n></div>
</code></div>
<div><br>
</div>
<div><font size=3D"4">Evidence</font></div>
<div><font size=3D"4"><br>
</font></div>
<div>These discussions on the std-proposals list are also arose
from the same problem:</div>
<div>
<ul>
<li><a moz-do-not-send=3D"true"
href=3D"https://groups.google.com/a/isocpp.org/d/topic/std-proposals/TKyHxl=
c--B8/discussion">Named
base classes</a><br>
</li>
<li><a moz-do-not-send=3D"true"
href=3D"https://groups.google.com/a/isocpp.org/d/topic/std-proposals/sfeZ_r=
R2BvQ/discussion">decltype(return)</a><br>
</li>
</ul>
</div>
<div><br>
</div>
<div><font size=3D"6">The solution</font></div>
<div><br>
</div>
<div>The problem comes from the inability to declare the type
alias at the first place, and the solution is gonna to enable
it - with the extended <font face=3D"courier new, monospace">type=
def</font>.</div>
<div><br>
</div>
<div>In function return type:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</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">typedef</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type T =
f</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">()</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #800;" class=3D"styled-by-prettify">// yay!=
</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"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `T` from now on...</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">}</span></div>
</code></div>
<div><br>
</div>
</div>
</blockquote>
I'm not saying the feature is not needed. I believe however that the
proposal needs to compare what it is currently doable.<br>
<br>
Couldn't we use the existing language already<br>
<br>
<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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify">blahblah</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">...,
typename T =3D </span><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><span
style=3D"color: #000;" class=3D"styled-by-prettify"></span>=
<span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type </=
span></code>></span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
T
f</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: #800;" class=3D"styled-by-prettify">// yay!</sp=
an><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"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `T` from now on...</span><s=
pan
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span></div>
</code></div>
<blockquote
cite=3D"mid:cfbe556f-214a-4245-b257-f746424c63f2@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>In base-clause:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</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">class</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">Derived=
</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"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typedef=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">public<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type </=
span><span
style=3D"color: #606;" class=3D"styled-by-prettify">Base</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #800;" class=3D"styled-by-prettify">// yay!=
</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"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `Base` from now on...</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">}</span></div>
</code></div>
<div><br>
</div>
</div>
</blockquote>
<br>
<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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify">blahblah</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">...,
typename Base=3D</span><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><span
style=3D"color: #000;" class=3D"styled-by-prettify"></span>=
<span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type</s=
pan></code>></span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</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">Derived</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #660;" class=3D"styled-by-prettify">:</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"></span><spa=
n
style=3D"color: #008;" class=3D"styled-by-prettify">public</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"></span><spa=
n
style=3D"color: #606;" class=3D"styled-by-prettify">Base</span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #800;" class=3D"styled-by-prettify">// yay!</sp=
an><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"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `Base` from now on...</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span></div>
</code></div>
<div><br>
</div>
<blockquote
cite=3D"mid:cfbe556f-214a-4245-b257-f746424c63f2@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>Note how the occurrence of <i>access-specifier</i>=C2=A0in
base-clause differ in semantic:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">class</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> C </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">typedef=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T B </=
span><span
style=3D"color: #800;" class=3D"styled-by-prettify">// T:
private base; B: private typedef</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #008;"
class=3D"styled-by-prettify">class</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> C </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">typedef=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">public<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T B </=
span><span
style=3D"color: #800;" class=3D"styled-by-prettify">// T:
public base; B: private typedef</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #008;"
class=3D"styled-by-prettify">class</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> C </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">public<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typedef=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T B </=
span><span
style=3D"color: #800;" class=3D"styled-by-prettify">// T:
private base; B: public typedef</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #008;"
class=3D"styled-by-prettify">class</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> C </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">public<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typedef=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">public<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T B </=
span><span
style=3D"color: #800;" class=3D"styled-by-prettify">// T:
public base; B: public typedef</span></div>
</code></div>
<div><br>
</div>
<div>In parameter list:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</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">void</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> f</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typedef=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">SomeTem=
plate</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T a</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T b</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">);</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #800;" class=3D"styled-by-prettify">// yay!=
</span></div>
</code></div>
<div><br>
</div>
</div>
</blockquote>
I'm not sure the <code class=3D"prettyprint"><span style=3D"color:
#660;" class=3D"styled-by-prettify"></span><span style=3D"color:
#000;" class=3D"styled-by-prettify">blahblah</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"> could be
inferred<br>
<br>
Do tou mean<br>
<br>
</span></code><br>
<code class=3D"prettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span style=3D"color:
#660;" class=3D"styled-by-prettify"><class U</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">></span><spa=
n
style=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"> f</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(U, </span><spa=
n
style=3D"color: #008;" class=3D"styled-by-prettify">typedef</span><=
span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span
style=3D"color: #606;" class=3D"styled-by-prettify">SomeTemplate</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n
style=3D"color: #000;" class=3D"styled-by-prettify">U</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">></span><spa=
n
style=3D"color: #000;" class=3D"styled-by-prettify"> T a</span><spa=
n
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T b</span><spa=
n
style=3D"color: #660;" class=3D"styled-by-prettify">);<br>
<br>
If it is the case<br>
<br>
</span></code><br>
<code class=3D"prettyprint"><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><span
style=3D"color: #008;" class=3D"styled-by-prettify">template</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify"><class U=
</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">, class T =
=3D
</span></code></span></code><code class=3D"prettyprint"><span
style=3D"color: #660;" class=3D"styled-by-prettify"><code
class=3D"prettyprint"><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><span
style=3D"color: #660;" class=3D"styled-by-prettify"><code
class=3D"prettyprint"><span style=3D"color: #000;"
class=3D"styled-by-prettify"></span><span
style=3D"color: #606;" class=3D"styled-by-prettify">Som=
eTemplate</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><=
;</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">U</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify">>=
;</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"></s=
pan></code></span></code>
></span><span style=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"> f</span><s=
pan
style=3D"color: #660;" class=3D"styled-by-prettify">(U, </span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify">T a</span><=
span
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"> T b</span>=
<span
style=3D"color: #660;" class=3D"styled-by-prettify">);<br>
<br>
See=C2=A0 </span></code><a class=3D"moz-txt-link-freetext" href=
=3D"http://melpon.org/wandbox/permlink/FBlKcQZwxAs5ZJRT">http://melpon.org/=
wandbox/permlink/FBlKcQZwxAs5ZJRT</a><br>
<br>
</span></code>
<blockquote
cite=3D"mid:cfbe556f-214a-4245-b257-f746424c63f2@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>In deduced type:</div>
</div>
</blockquote>
I have not alternative to this with the current language :(<br>
<br>
Vicente<br>
</body>
</html>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b1ae66d2-da65-bd04-6ac0-8bed1d13c5c5%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b1ae66d2-da65-bd04-6ac0-8bed1d13c5c5=
%40wanadoo.fr</a>.<br />
--------------5CA4DAA407AE010D0050BCCF--
.
Author: TONGARI J <tongari95@gmail.com>
Date: Sun, 5 Feb 2017 04:37:14 -0800 (PST)
Raw View
------=_Part_4472_1640338671.1486298234969
Content-Type: multipart/alternative;
boundary="----=_Part_4473_1044448251.1486298234970"
------=_Part_4473_1044448251.1486298234970
Content-Type: text/plain; charset=UTF-8
Hi Bengt,
Thanks for bringing this thread up :)
On Sunday, February 5, 2017 at 6:03:46 PM UTC+8, Bengt Gustafsson wrote:
>
> I like it, but it does take some getting used to the stacking of
> identifiers in parameter and variable declaration cases. Also, in these
> cases, I suspect there could be some parsing issues, especially if the name
> of the type is defined in an outer scope. Maybe you'd have to
> clarify why this is not a problem. Then again, I can't really produce a
> problematic example so maybe I'm just seeing ghosts here. However, an
> example involving an array size bracket would be interesting as it comes
> after the identifier.
>
If the parser sees a second unqualified id (possibly preceded by some '*'
or '&') after the typedef declarator, the second one will be interpreted as
the declarator of the type that the typedef declarator declares.
typedef int A[2] a; // A == int[2], decltype(a) == A
typedef int F(int) f; // F == int(int), decltype(f) == F
typedef int A a[2]; // A == int, decltype(a) == int[2]
typedef int F f(int); // F == int, decltype(f) == int(int)
> This brings up a wrinkle in the last example:
>
> typedef int* P p1 = nullptr, p2 = nullptr, *p3 = nullptr; // p1 & p2 are
> both `int*`, and p3 is `int**`
>
> Here you must make it clear that there is a new rule in play compared to
> what would be the most logical interpretation compared to current language
> rules: That the * would only apply to the next identifier being declared.
>
That's actually not changed. In this case, the next identifier being
declared is `P`, which is in turn, the decl-specifier of the subsequent
variables.
Instead the new rule is as you explain, which is necessary for the use case
> of return type.
>
--
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/a316ab77-56ff-4fcc-a3d9-ddfcdf1aae5e%40isocpp.org.
------=_Part_4473_1044448251.1486298234970
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi Bengt,<div><br></div><div>Thanks for bringing this thre=
ad up :)<br><br>On Sunday, February 5, 2017 at 6:03:46 PM UTC+8, Bengt Gust=
afsson wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
I like it, but it does take some getting used to the stacking of identifier=
s in parameter and variable declaration cases. Also, in these cases, I susp=
ect there could be some parsing issues, especially if the name of the type =
is defined in an outer scope. Maybe you'd have to<div>clarify why this =
is not a problem. Then again, I can't really produce a problematic exam=
ple so maybe I'm just seeing ghosts here. However, an example involving=
an array size bracket would be interesting as it comes after the identifie=
r.</div></div></blockquote><div><br></div><div>If the parser sees a second =
unqualified id (possibly preceded by=C2=A0some '*' or '&=
9;) after the typedef declarator, the second one will be interpreted as the=
declarator of the type that the typedef=C2=A0declarator=C2=A0declares.</di=
v><div><br></div><div class=3D"prettyprint" style=3D"background-color: rgb(=
250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bord=
er-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div cla=
ss=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">typedef</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</sp=
an><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: #066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">]</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">=
// A =3D=3D=C2=A0</span><span style=3D"color: rgb(136, 0, 0); font-family: =
Arial, Helvetica, sans-serif;">int[2], decltype(</span><span style=3D"color=
: rgb(136, 0, 0); font-family: Arial, Helvetica, sans-serif;">a) =3D=3D A</=
span></div><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typedef</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> F</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> f</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D=
"styled-by-prettify">// F =3D=3D int(int),=C2=A0</span><span style=3D"font-=
family: Arial, Helvetica, sans-serif; color: rgb(136, 0, 0);">decltype(</sp=
an><span style=3D"font-family: Arial, Helvetica, sans-serif; color: rgb(136=
, 0, 0);">f) =3D=3D F</span></div></code></div><div><br></div><div><div cla=
ss=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-co=
lor: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap:=
break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify"><span class=3D"style=
d-by-prettify">typedef</span><span class=3D"styled-by-prettify" style=3D"co=
lor: rgb(0, 0, 0);">=C2=A0</span><span class=3D"styled-by-prettify">int</sp=
an><span class=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);">=C2=A0=
A a[2];</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(13=
6, 0, 0);">// A =3D=3D int</span><span style=3D"color: rgb(136, 0, 0); font=
-family: Arial, Helvetica, sans-serif;">, decltype(</span><span style=3D"co=
lor: rgb(136, 0, 0); font-family: Arial, Helvetica, sans-serif;">a) =3D=3D=
=C2=A0</span><span style=3D"color: rgb(136, 0, 0); font-family: Arial, Helv=
etica, sans-serif;">int[2]</span><br>typedef</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> F f</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #800;" class=3D"styled-by-prettify">//=C2=A0</span><span =
style=3D"color: rgb(136, 0, 0); font-family: Arial, Helvetica, sans-serif;"=
>F =3D=3D int,=C2=A0</span><span style=3D"font-family: Arial, Helvetica, sa=
ns-serif; color: rgb(136, 0, 0);">decltype(</span><span style=3D"font-famil=
y: Arial, Helvetica, sans-serif; color: rgb(136, 0, 0);">f) =3D=3D=C2=A0</s=
pan><span style=3D"color: rgb(136, 0, 0);">int(int)<br></span></div></code>=
</div><br></div><div>=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 brings up a wrinkle in the last example:</div=
><div><br></div><div><div><div style=3D"border-width:1px;border-style:solid=
;border-color:rgb(187,187,187);background-color:rgb(250,250,250);word-wrap:=
break-word"><code><span style=3D"color:rgb(0,0,136)">typedef</span><span st=
yle=3D"color:rgb(0,0,0)">=C2=A0</span><span style=3D"color:rgb(0,0,136)">in=
t</span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:r=
gb(0,0,0)">=C2=A0P p1=C2=A0</span><span style=3D"color:rgb(102,102,0)">=3D<=
/span><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=3D"color:rg=
b(0,0,136)">nullptr</span><span style=3D"color:rgb(102,102,0)">,</span><spa=
n style=3D"color:rgb(0,0,0)">=C2=A0p2=C2=A0</span><span style=3D"color:rgb(=
102,102,0)">=3D</span><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span s=
tyle=3D"color:rgb(0,0,136)">nullptr</span><span style=3D"color:rgb(102,102,=
0)">,</span><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=3D"co=
lor:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">p<wbr>3=C2=A0<=
/span><span style=3D"color:rgb(102,102,0)">=3D</span><span style=3D"color:r=
gb(0,0,0)">=C2=A0</span><span style=3D"color:rgb(0,0,136)">nullptr</span><s=
pan style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"=
>=C2=A0</span><span style=3D"color:rgb(136,0,0)">// p1 & p2 are both `i=
nt*`, and p3 is `int**`</span></code></div></div><div><code><span style=3D"=
color:rgb(136,0,0)"><br></span></code></div><div><font color=3D"#880000" fa=
ce=3D"monospace">Here you must make it clear that there is a new rule in pl=
ay compared to what would be the most logical interpretation compared to cu=
rrent language rules: That the * would only apply to the next identifier be=
ing declared.</font></div></div></div></blockquote><div><br></div><div>That=
's actually not changed. In this case, the=C2=A0next identifier being d=
eclared is `P`, which is in turn, the decl-specifier of the subsequent vari=
ables.</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr"><div><div><font color=3D"#880000" face=3D"monospace">Instead =
the new rule is as you explain, which is necessary for the use case of retu=
rn type.</font></div></div></div></blockquote></div></div>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a316ab77-56ff-4fcc-a3d9-ddfcdf1aae5e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a316ab77-56ff-4fcc-a3d9-ddfcdf1aae5e=
%40isocpp.org</a>.<br />
------=_Part_4473_1044448251.1486298234970--
------=_Part_4472_1640338671.1486298234969--
.
Author: TONGARI J <tongari95@gmail.com>
Date: Sun, 5 Feb 2017 04:56:11 -0800 (PST)
Raw View
------=_Part_4584_265284119.1486299371968
Content-Type: multipart/alternative;
boundary="----=_Part_4585_2063778322.1486299371969"
------=_Part_4585_2063778322.1486299371969
Content-Type: text/plain; charset=UTF-8
On Sunday, February 5, 2017 at 6:41:36 PM UTC+8, Vicente J. Botet Escriba
wrote:
>
> I'm not saying the feature is not needed. I believe however that the
> proposal needs to compare what it is currently doable.
>
> Couldn't we use the existing language already
>
> template<blahblah..., typename T = typename MetaFunc<blahblah...>::type >
> T f() // yay!
> {
> // Use `T` from now on...
> }
>
> In this case, it's just an alternative w/o (ab)using the template param,
like how concept-lite tries to eliminate enable_if trick.
> template<blahblah..., typename Base=typename MetaFunc<blahblah...>::type>
> class Derived : public Base // yay!
> {
> // Use `Base` from now on...
> }
>
This does not work if "blahblah...", is actually a template parameter pack,
which has to be the last one.
> In parameter list:
> template<blahblah...>
> void f(typedef SomeTemplate<blahblah...> T a, T b); // yay!
>
> I'm not sure the blahblah could be inferred
>
> Do tou mean
>
>
> template<class U>
> void f(U, typedef SomeTemplate<U> T a, T b);
>
I mean something like:
template<class... Args>
void f(typedef std::tuple<Args...> T a, T b);
f(std::make_tuple(1, 2), std::make_tuple(3, 4)); //Args == {int, int}, T ==
std::tuple<int, int>
--
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/fc42405f-b5de-492a-9e7e-e191a6dd975c%40isocpp.org.
------=_Part_4585_2063778322.1486299371969
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, February 5, 2017 at 6:41:36 PM UTC+8, Vicente J=
.. Botet Escriba wrote:=C2=A0<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv bgcolor=3D"#FFFFFF" text=3D"#000000"><div>I'm not saying the feature=
is not needed. I believe however that the
proposal needs to compare what it is currently doable.<br></div>
<br>
Couldn't we use the existing language already<br>
<br>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,18=
7,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#008">template</span><span style=3D"color=
:#660"><</span><span style=3D"color:#000">blahblah</span><span style=3D"=
color:#660">...,
typename T =3D </span><span style=3D"color:#660"><code><span st=
yle=3D"color:#000"></span><span style=3D"color:#008">typename</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#606">MetaFunc</span><span=
style=3D"color:#660"><</span><span style=3D"color:#000">blahblah</span>=
<span style=3D"color:#660">...>::</span><span style=3D"color:#000">type =
</span></code>></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#000">T
f</span><span style=3D"color:#660">()</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#800">// yay!</span><span style=3D"col=
or:#000"><br>
</span><span style=3D"color:#660">{</span><span style=3D"color:#0=
00"><br>
=C2=A0 =C2=A0 </span><span style=3D"color:#800">// Use `T` from=
now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div></div></div></blockquote></div></blockquote><div>In this case,=
it's just an alternative w/o (ab)using the template param, like how co=
ncept-lite tries to eliminate enable_if trick.</div><div>=C2=A0</div><block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#00=
0000">
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,18=
7,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#008">template</span><span style=3D"color=
:#660"><</span><span style=3D"color:#000">blahblah</span><span style=3D"=
color:#660">...,
typename Base=3D</span><span style=3D"color:#660"><code><span s=
tyle=3D"color:#000"></span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> </span><span style=3D"color:#606">MetaFunc</span><spa=
n style=3D"color:#660"><</span><span style=3D"color:#000">blahblah</span=
><span style=3D"color:#660">...>::</span><span style=3D"color:#000">type=
</span></code>></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#008">class</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#606">Derived</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">:</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#000"></span><span style=3D"color:#008">pu=
blic</span><span style=3D"color:#000"> </span><span style=3D"color:#000"></=
span><span style=3D"color:#606">Base</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#800">// yay!</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">{</span><span style=3D"color:#0=
00"><br>
=C2=A0 =C2=A0 </span><span style=3D"color:#800">// Use `Base` f=
rom now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div></code></div></di=
v></blockquote><div>=C2=A0</div><div>This does not work if "<span styl=
e=3D"background-color: rgb(250, 250, 250); color: rgb(0, 0, 0); font-family=
: monospace;">blahblah...</span>", is actually a template parameter pa=
ck, which has to be the last one.</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000"><blockquote type=3D"cite=
">
<div dir=3D"ltr">
=20
<div>In parameter list:</div>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(18=
7,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#008">template</span><span style=3D"c=
olor:#660"><</span><span style=3D"color:#000">blahblah</span><span style=
=3D"color:#660">...></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#008">void</span><span style=3D"c=
olor:#000"> f</span><span style=3D"color:#660">(</span><span style=3D"color=
:#008">typedef</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#606">SomeTemplate</span><span style=3D"color:#660"><</span><span styl=
e=3D"color:#000">blahblah</span><span style=3D"color:#660">...></span><s=
pan style=3D"color:#000"> T a</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> T b</span><span style=3D"color:#660">);</span><span=
style=3D"color:#000"> </span><span style=3D"color:#800">// yay!</span></di=
v>
</code></div>
<div><br>
</div>
</div>
</blockquote>
I'm not sure the <code><span style=3D"color:#660"></span><span styl=
e=3D"color:#000">blahblah</span><span style=3D"color:#660"> could be
inferred<br>
<br>
Do tou mean<br>
<br>
</span></code><br>
<code><span style=3D"color:#008">template</span><span style=3D"color:#6=
60"><class U</span><span style=3D"color:#660">></span><span style=3D"=
color:#000"><br>
</span><span style=3D"color:#008">void</span><span style=3D"color:#00=
0"> f</span><span style=3D"color:#660">(U, </span><span style=3D"color:#008=
">typedef</span><span style=3D"color:#000"> </span><span style=3D"color:#60=
6">SomeTemplate</span><span style=3D"color:#660"><</span><span style=3D"=
color:#000">U</span><span style=3D"color:#660">></span><span style=3D"co=
lor:#000"> T a</span><span style=3D"color:#660">,</span><span style=3D"colo=
r:#000"> T b</span><span style=3D"color:#660">);<br></span></code></div></b=
lockquote><div><br></div><div>I mean something like:</div><div class=3D"pre=
ttyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-wo=
rd;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">class</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: #606;" class=3D"=
styled-by-prettify">Args</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">typedef</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">tuple</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify"><</span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">Args</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...></span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> T a</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> T b</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><font color=3D"#660066"><span style=3D"color: #000;" class=3D"styled=
-by-prettify">f</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">make_tuple</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">1</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: #066;" class=3D"=
styled-by-prettify">2</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">),</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span></font><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">make_tuple</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><font =
color=3D"#006666"><span style=3D"color: #066;" class=3D"styled-by-prettify"=
>3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #066;" class=3D"styled-by-prettify">4</span></font><span style=
=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: #800;=
" class=3D"styled-by-prettify">//Args =3D=3D {int, int}, T =3D=3D std::tupl=
e<int, int></span></div></code></div></div>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fc42405f-b5de-492a-9e7e-e191a6dd975c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fc42405f-b5de-492a-9e7e-e191a6dd975c=
%40isocpp.org</a>.<br />
------=_Part_4585_2063778322.1486299371969--
------=_Part_4584_265284119.1486299371968--
.
Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Sun, 5 Feb 2017 05:22:36 -0800 (PST)
Raw View
------=_Part_1026_1088320546.1486300956941
Content-Type: multipart/alternative;
boundary="----=_Part_1027_635710659.1486300956942"
------=_Part_1027_635710659.1486300956942
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
@Vicente: You present some nice solutions for the current language, but the=
=20
drawback is of course that it is not obvious that it is *forbidden* to=20
change the default value of the parameter. The other, minor, issue is that=
=20
the template parameter name is not usable outside the template itself,=20
which the typedef name would be.
Nevertheless it is of course advisable to mention theses possibilities in a=
=20
future proposal, as you say.
I see a problem with the proposal in that it has fairly complicated rules=
=20
to learn, and the meaning differs depending on where you place your=20
public's and const's. I'm not sure if the utility of the function outweighs=
=20
the extra burden of having to learn and remember these extra rules.
We also have decltype to solve some of the use cases.
Den s=C3=B6ndag 5 februari 2017 kl. 13:56:12 UTC+1 skrev TONGARI J:
>
> On Sunday, February 5, 2017 at 6:41:36 PM UTC+8, Vicente J. Botet Escriba=
=20
> wrote:=20
>>
>> I'm not saying the feature is not needed. I believe however that the=20
>> proposal needs to compare what it is currently doable.
>>
>> Couldn't we use the existing language already
>>
>> template<blahblah..., typename T =3D typename MetaFunc<blahblah...>::typ=
e >
>> T f() // yay!
>> {
>> // Use `T` from now on...
>> }
>>
>> In this case, it's just an alternative w/o (ab)using the template param,=
=20
> like how concept-lite tries to eliminate enable_if trick.
> =20
>
>> template<blahblah..., typename Base=3Dtypename MetaFunc<blahblah...>::ty=
pe>
>> class Derived : public Base // yay!
>> {
>> // Use `Base` from now on...
>> }
>>
> =20
> This does not work if "blahblah...", is actually a template parameter=20
> pack, which has to be the last one.
>
>> In parameter list:
>> template<blahblah...>
>> void f(typedef SomeTemplate<blahblah...> T a, T b); // yay!
>>
>> I'm not sure the blahblah could be inferred
>>
>> Do tou mean
>>
>>
>> template<class U>
>> void f(U, typedef SomeTemplate<U> T a, T b);
>>
>
> I mean something like:
> template<class... Args>
> void f(typedef std::tuple<Args...> T a, T b);
>
> f(std::make_tuple(1, 2), std::make_tuple(3, 4)); //Args =3D=3D {int, int}=
, T=20
> =3D=3D std::tuple<int, int>
>
--=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/3fbbd6b8-9087-4c02-bf66-632b7eff480d%40isocpp.or=
g.
------=_Part_1027_635710659.1486300956942
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">@Vicente: You present some nice solutions for the current =
language, but the drawback is of course that it is not obvious that it is <=
i>forbidden</i>=C2=A0to change the default value of the parameter. The othe=
r, minor, issue is that the template parameter name is not usable outside t=
he template itself, which the typedef name would be.<div><br></div><div>Nev=
ertheless it is of course advisable to mention theses possibilities in a fu=
ture proposal, as you say.</div><div><br></div><div>I see a problem with th=
e proposal in that it has fairly complicated rules to learn, and the meanin=
g differs depending on where you place your public's and const's. I=
'm not sure if the utility of the function outweighs the extra burden o=
f having to learn and remember these extra rules.</div><div><br></div><div>=
We also have decltype to solve some of the use cases.</div><div><br><br>Den=
s=C3=B6ndag 5 februari 2017 kl. 13:56:12 UTC+1 skrev TONGARI J:<blockquote=
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1=
px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Sunday, February 5, 2=
017 at 6:41:36 PM UTC+8, Vicente J. Botet Escriba wrote:=C2=A0<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div bgcolor=3D"#FFFFFF" text=3D"#000000"><div>I=
'm not saying the feature is not needed. I believe however that the
proposal needs to compare what it is currently doable.<br></div>
<br>
Couldn't we use the existing language already<br>
<br>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,18=
7,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#008">template</span><span style=3D"color=
:#660"><</span><span style=3D"color:#000">blahblah</span><span style=3D"=
color:#660">...,
typename T =3D </span><span style=3D"color:#660"><code><span st=
yle=3D"color:#000"></span><span style=3D"color:#008">typename</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#606">MetaFunc</span><span=
style=3D"color:#660"><</span><span style=3D"color:#000">blahblah</span>=
<span style=3D"color:#660">...>::</span><span style=3D"color:#000">type =
</span></code>></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#000">T
f</span><span style=3D"color:#660">()</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#800">// yay!</span><span style=3D"col=
or:#000"><br>
</span><span style=3D"color:#660">{</span><span style=3D"color:#0=
00"><br>
=C2=A0 =C2=A0 </span><span style=3D"color:#800">// Use `T` from=
now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div></div></div></blockquote></div></blockquote><div>In this case,=
it's just an alternative w/o (ab)using the template param, like how co=
ncept-lite tries to eliminate enable_if trick.</div><div>=C2=A0</div><block=
quote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left=
:1px #ccc solid;padding-left:1ex"><div bgcolor=3D"#FFFFFF" text=3D"#000000"=
>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,18=
7,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#008">template</span><span style=3D"color=
:#660"><</span><span style=3D"color:#000">blahblah</span><span style=3D"=
color:#660">...,
typename Base=3D</span><span style=3D"color:#660"><code><span s=
tyle=3D"color:#000"></span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> </span><span style=3D"color:#606">MetaFunc</span><spa=
n style=3D"color:#660"><</span><span style=3D"color:#000">blahblah</span=
><span style=3D"color:#660">...>::</span><span style=3D"color:#000">type=
</span></code>></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#008">class</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#606">Derived</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">:</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#000"></span><span style=3D"color:#008">pu=
blic</span><span style=3D"color:#000"> </span><span style=3D"color:#000"></=
span><span style=3D"color:#606">Base</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#800">// yay!</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">{</span><span style=3D"color:#0=
00"><br>
=C2=A0 =C2=A0 </span><span style=3D"color:#800">// Use `Base` f=
rom now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div></code></div></di=
v></blockquote><div>=C2=A0</div><div>This does not work if "<span styl=
e=3D"background-color:rgb(250,250,250);color:rgb(0,0,0);font-family:monospa=
ce">blahblah...</span>", is actually a template parameter pack, which =
has to be the last one.</div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div b=
gcolor=3D"#FFFFFF" text=3D"#000000"><blockquote type=3D"cite">
<div dir=3D"ltr">
=20
<div>In parameter list:</div>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(18=
7,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#008">template</span><span style=3D"c=
olor:#660"><</span><span style=3D"color:#000">blahblah</span><span style=
=3D"color:#660">...></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#008">void</span><span style=3D"c=
olor:#000"> f</span><span style=3D"color:#660">(</span><span style=3D"color=
:#008">typedef</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#606">SomeTemplate</span><span style=3D"color:#660"><</span><span styl=
e=3D"color:#000">blahblah</span><span style=3D"color:#660">...></span><s=
pan style=3D"color:#000"> T a</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> T b</span><span style=3D"color:#660">);</span><span=
style=3D"color:#000"> </span><span style=3D"color:#800">// yay!</span></di=
v>
</code></div>
<div><br>
</div>
</div>
</blockquote>
I'm not sure the <code><span style=3D"color:#660"></span><span styl=
e=3D"color:#000">blahblah</span><span style=3D"color:#660"> could be
inferred<br>
<br>
Do tou mean<br>
<br>
</span></code><br>
<code><span style=3D"color:#008">template</span><span style=3D"color:#6=
60"><class U</span><span style=3D"color:#660">></span><span style=3D"=
color:#000"><br>
</span><span style=3D"color:#008">void</span><span style=3D"color:#00=
0"> f</span><span style=3D"color:#660">(U, </span><span style=3D"color:#008=
">typedef</span><span style=3D"color:#000"> </span><span style=3D"color:#60=
6">SomeTemplate</span><span style=3D"color:#660"><</span><span style=3D"=
color:#000">U</span><span style=3D"color:#660">></span><span style=3D"co=
lor:#000"> T a</span><span style=3D"color:#660">,</span><span style=3D"colo=
r:#000"> T b</span><span style=3D"color:#660">);<br></span></code></div></b=
lockquote><div><br></div><div>I mean something like:</div><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color=
:#008">template</span><span style=3D"color:#660"><</span><span style=3D"=
color:#008">class</span><span style=3D"color:#660">...</span><span style=3D=
"color:#000"> </span><span style=3D"color:#606">Args</span><span style=3D"c=
olor:#660">></span><span style=3D"color:#000"><br></span><span style=3D"=
color:#008">void</span><span style=3D"color:#000"> f</span><span style=3D"c=
olor:#660">(</span><span style=3D"color:#008">typedef</span><span style=3D"=
color:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"c=
olor:#000">tuple</span><span style=3D"color:#660"><</span><span style=3D=
"color:#606">Args</span><span style=3D"color:#660">...></span><span styl=
e=3D"color:#000"> T a</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> T b</span><span style=3D"color:#660">);</span><span style=
=3D"color:#000"><br><br></span><font color=3D"#660066"><span style=3D"color=
:#000">f</span><span style=3D"color:#660">(</span><span style=3D"color:#000=
">std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">=
make_tuple</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
66">1</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#066">2</span><span style=3D"color:#660">),</sp=
an><span style=3D"color:#000"> </span></font><span style=3D"color:#000">std=
</span><span style=3D"color:#660">::</span><span style=3D"color:#000">make_=
tuple</span><span style=3D"color:#660">(</span><font color=3D"#006666"><spa=
n style=3D"color:#066">3</span><span style=3D"color:#660">,</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#066">4</span></font><span s=
tyle=3D"color:#660">));</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#800">//Args =3D=3D {int, int}, T =3D=3D std::tuple<int, int&=
gt;</span></div></code></div></div></blockquote></div></div>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3fbbd6b8-9087-4c02-bf66-632b7eff480d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3fbbd6b8-9087-4c02-bf66-632b7eff480d=
%40isocpp.org</a>.<br />
------=_Part_1027_635710659.1486300956942--
------=_Part_1026_1088320546.1486300956941--
.
Author: Bjorn Reese <breese@mail1.stofanet.dk>
Date: Sun, 5 Feb 2017 14:38:19 +0100
Raw View
On 02/05/2017 11:41 AM, Vicente J. Botet Escriba wrote:
> |
> template<blahblah..., typename Base=|typenameMetaFunc<blahblah...>::type|>
> classDerived:publicBase// yay!
> {
> // Use `Base` from now on...
> }
> |
Does this work for partial template specialization or CRTP?
--
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/228f228e-4776-b878-284d-4b81c2ab2aca%40mail1.stofanet.dk.
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Sun, 5 Feb 2017 14:56:35 +0100
Raw View
This is a multi-part message in MIME format.
--------------D4F2F8D6BC7572938EFADC2F
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 05/02/2017 =C3=A0 14:22, Bengt Gustafsson a =C3=A9crit :
> @Vicente: You present some nice solutions for the current language,=20
> but the drawback is of course that it is not obvious that it is=20
> /forbidden/ to change the default value of the parameter.
I don't understand, could you clarify?
> The other, minor, issue is that the template parameter name is not=20
> usable outside the template itself, which the typedef name would be.
Yes, this could be important on the base class case. For this case you=20
could define a nested alias.
|
template<blahblah..., typename Base=3D|typenameMetaFunc<blahblah...>::type|=
>
classDerived:publicBase// yay!
{
public: using base_type =3D Base;
// Use `Base` from now on...
}
|
Could you show an example where the base type is needed outside the=20
Derived class?
>
> Nevertheless it is of course advisable to mention theses possibilities=20
> in a future proposal, as you say.
>
> I see a problem with the proposal in that it has fairly complicated=20
> rules to learn, and the meaning differs depending on where you place=20
> your public's and const's. I'm not sure if the utility of the function=20
> outweighs the extra burden of having to learn and remember these extra=20
> rules.
I agree with you here. It is too complex. We just need a name.
Vicente
>
> We also have decltype to solve some of the use cases.
>
>
> Den s=C3=B6ndag 5 februari 2017 kl. 13:56:12 UTC+1 skrev TONGARI J:
>
> On Sunday, February 5, 2017 at 6:41:36 PM UTC+8, Vicente J. Botet
> Escriba wrote:
>
> I'm not saying the feature is not needed. I believe however
> that the proposal needs to compare what it is currently doable.
>
> Couldn't we use the existing language already
>
> |
> template<blahblah..., typename T =3D
> |typenameMetaFunc<blahblah...>::type |>
> T f()// yay!
> {
> // Use `T` from now on...
> }
> |
>
> In this case, it's just an alternative w/o (ab)using the template
> param, like how concept-lite tries to eliminate enable_if trick.
>
> |
> template<blahblah..., typename
> Base=3D|typenameMetaFunc<blahblah...>::type|>
> classDerived:publicBase// yay!
> {
> // Use `Base` from now on...
> }
> |
>
> This does not work if "blahblah...", is actually a template
> parameter pack, which has to be the last one.
>
>> In parameter list:
>> |
>> template<blahblah...>
>> voidf(typedefSomeTemplate<blahblah...>T a,T b);// yay!
>> |
>>
> I'm not sure the |blahblahcould be inferred
>
> Do tou mean
>
> |
> |template<class U>
> voidf(U, typedefSomeTemplate<U>T a,T b);
> |
>
>
> I mean something like:
> |
> template<class...Args>
> voidf(typedefstd::tuple<Args...>T a,T b);
>
> f(std::make_tuple(1,2),std::make_tuple(3,4));//Args =3D=3D {int, int}=
,
> T =3D=3D std::tuple<int, int>
> |
>
> --=20
> You received this message because you are subscribed to the Google=20
> Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send=20
> an email to std-proposals+unsubscribe@isocpp.org=20
> <mailto:std-proposals+unsubscribe@isocpp.org>.
> To post to this group, send email to std-proposals@isocpp.org=20
> <mailto:std-proposals@isocpp.org>.
> To view this discussion on the web visit=20
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3fbbd6b8-908=
7-4c02-bf66-632b7eff480d%40isocpp.org=20
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3fbbd6b8-90=
87-4c02-bf66-632b7eff480d%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>.
--=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/7aa018bf-dcaa-6c95-dd64-413990592c37%40wanadoo.f=
r.
--------------D4F2F8D6BC7572938EFADC2F
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 05/02/2017 =C3=A0 14:22, Bengt Gustaf=
sson
a =C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:3fbbd6b8-9087-4c02-bf66-632b7eff480d@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">@Vicente: You present some nice solutions for the
current language, but the drawback is of course that it is not
obvious that it is <i>forbidden</i>=C2=A0to change the default valu=
e
of the parameter. </div>
</blockquote>
I don't understand, could you clarify?<br>
<blockquote
cite=3D"mid:3fbbd6b8-9087-4c02-bf66-632b7eff480d@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">The other, minor, issue is that the template
parameter name is not usable outside the template itself, which
the typedef name would be.</div>
</blockquote>
Yes, this could be important on the base class case. For this case
you could define a nested alias.<br>
<br>
<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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify">blahblah</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">...,
typename Base=3D</span><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><span
style=3D"color: #000;" class=3D"styled-by-prettify"></span>=
<span
style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type</s=
pan></code>></span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</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">Derived</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #660;" class=3D"styled-by-prettify">:</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"></span><spa=
n
style=3D"color: #008;" class=3D"styled-by-prettify">public</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"></span><spa=
n
style=3D"color: #606;" class=3D"styled-by-prettify">Base</span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #800;" class=3D"styled-by-prettify">// yay!</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
{<br>
public: using base_type =3D Base;<br>
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `Base` from now on...</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span></div>
</code></div>
<br>
Could you show an example where the base type is needed outside the
Derived class? <br>
<blockquote
cite=3D"mid:3fbbd6b8-9087-4c02-bf66-632b7eff480d@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div><br>
</div>
<div>Nevertheless it is of course advisable to mention theses
possibilities in a future proposal, as you say.</div>
<div><br>
</div>
<div>I see a problem with the proposal in that it has fairly
complicated rules to learn, and the meaning differs depending
on where you place your public's and const's. I'm not sure if
the utility of the function outweighs the extra burden of
having to learn and remember these extra rules.</div>
</div>
</blockquote>
I agree with you here. It is too complex. We just need a name.<br>
<br>
Vicente<br>
<blockquote
cite=3D"mid:3fbbd6b8-9087-4c02-bf66-632b7eff480d@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div><br>
</div>
<div>We also have decltype to solve some of the use cases.</div>
<div><br>
<br>
Den s=C3=B6ndag 5 februari 2017 kl. 13:56:12 UTC+1 skrev TONGARI =
J:
<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">On Sunday, February 5, 2017 at 6:41:36 PM
UTC+8, Vicente J. Botet Escriba wrote:=C2=A0
<blockquote class=3D"gmail_quote"
style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>I'm not saying the feature is not needed. I
believe however that the proposal needs to compare
what it is currently doable.<br>
</div>
<br>
Couldn't we use the existing language already<br>
<br>
<div
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>
<div><span style=3D"color:#008">template</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">..., typename T =3D </span><=
span
style=3D"color:#660"><code><span
style=3D"color:#000"></span><span
style=3D"color:#008">typename</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">MetaFunc</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...>::</span><span
style=3D"color:#000">type </span></code>><=
/span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#000">T f</span><span
style=3D"color:#660">()</span><span
style=3D"color:#000"> </span><span
style=3D"color:#800">// yay!</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:#800">/=
/ Use
`T` from now on...</span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
<blockquote type=3D"cite">
<div dir=3D"ltr"> </div>
</blockquote>
</div>
</blockquote>
<div>In this case, it's just an alternative w/o (ab)using
the template param, like how concept-lite tries to
eliminate enable_if trick.</div>
<div>=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 bgcolor=3D"#FFFFFF" text=3D"#000000">
<div
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>
<div><span style=3D"color:#008">template</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">..., typename Base=3D</span>=
<span
style=3D"color:#660"><code><span
style=3D"color:#000"></span><span
style=3D"color:#008">typename</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">MetaFunc</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...>::</span><span
style=3D"color:#000">type</span></code>></=
span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#008">class</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">Derived</span><span
style=3D"color:#000"> </span><span
style=3D"color:#660">:</span><span
style=3D"color:#000"> </span><span
style=3D"color:#000"></span><span
style=3D"color:#008">public</span><span
style=3D"color:#000"> </span><span
style=3D"color:#000"></span><span
style=3D"color:#606">Base</span><span
style=3D"color:#000"> </span><span
style=3D"color:#800">// yay!</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:#800">/=
/ Use
`Base` from now on...</span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
</div>
</blockquote>
<div>=C2=A0</div>
<div>This does not work if "<span
style=3D"background-color:rgb(250,250,250);color:rgb(0,0,0);font-family:mon=
ospace">blahblah...</span>",
is actually a template parameter pack, which has to be
the last one.</div>
<blockquote class=3D"gmail_quote"
style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>In parameter list:</div>
<div
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>
<div><span style=3D"color:#008">template</span><s=
pan
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...></span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#008">void</span><s=
pan
style=3D"color:#000"> f</span><span
style=3D"color:#660">(</span><span
style=3D"color:#008">typedef</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">SomeTemplate</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...></span><span
style=3D"color:#000"> T a</span><span
style=3D"color:#660">,</span><span
style=3D"color:#000"> T b</span><span
style=3D"color:#660">);</span><span
style=3D"color:#000"> </span><span
style=3D"color:#800">// yay!</span></div>
</code></div>
<div><br>
</div>
</div>
</blockquote>
I'm not sure the <code><span style=3D"color:#660"></span>=
<span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660"> could be inferred<br>
<br>
Do tou mean<br>
<br>
</span></code><br>
<code><span style=3D"color:#008">template</span><span
style=3D"color:#660"><class U</span><span
style=3D"color:#660">></span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#008">void</span><span
style=3D"color:#000"> f</span><span
style=3D"color:#660">(U, </span><span
style=3D"color:#008">typedef</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">SomeTemplate</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">U</span><span
style=3D"color:#660">></span><span
style=3D"color:#000"> T a</span><span
style=3D"color:#660">,</span><span
style=3D"color:#000"> T b</span><span
style=3D"color:#660">);<br>
</span></code></div>
</blockquote>
<div><br>
</div>
<div>I mean something like:</div>
<div
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>
<div><span style=3D"color:#008">template</span><span
style=3D"color:#660"><</span><span
style=3D"color:#008">class</span><span
style=3D"color:#660">...</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">Args</span><span
style=3D"color:#660">></span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#008">void</span><span
style=3D"color:#000"> f</span><span
style=3D"color:#660">(</span><span
style=3D"color:#008">typedef</span><span
style=3D"color:#000"> std</span><span
style=3D"color:#660">::</span><span
style=3D"color:#000">tuple</span><span
style=3D"color:#660"><</span><span
style=3D"color:#606">Args</span><span
style=3D"color:#660">...></span><span
style=3D"color:#000"> T a</span><span
style=3D"color:#660">,</span><span
style=3D"color:#000"> T b</span><span
style=3D"color:#660">);</span><span
style=3D"color:#000"><br>
<br>
</span><font color=3D"#660066"><span
style=3D"color:#000">f</span><span
style=3D"color:#660">(</span><span
style=3D"color:#000">std</span><span
style=3D"color:#660">::</span><span
style=3D"color:#000">make_tuple</span><span
style=3D"color:#660">(</span><span
style=3D"color:#066">1</span><span
style=3D"color:#660">,</span><span
style=3D"color:#000"> </span><span
style=3D"color:#066">2</span><span
style=3D"color:#660">),</span><span
style=3D"color:#000"> </span></font><span
style=3D"color:#000">std</span><span
style=3D"color:#660">::</span><span
style=3D"color:#000">make_tuple</span><span
style=3D"color:#660">(</span><font color=3D"#006666">=
<span
style=3D"color:#066">3</span><span
style=3D"color:#660">,</span><span
style=3D"color:#000"> </span><span
style=3D"color:#066">4</span></font><span
style=3D"color:#660">));</span><span
style=3D"color:#000"> </span><span
style=3D"color:#800">//Args =3D=3D {int, int}, T =3D=
=3D
std::tuple<int, int></span></div>
</code></div>
</div>
</blockquote>
</div>
</div>
-- <br>
You received this message because you are subscribed to the Google
Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it,
send an email to <a moz-do-not-send=3D"true"
href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+=
unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a moz-do-not-send=3D"true"
href=3D"mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</=
a>.<br>
To view this discussion on the web visit <a
moz-do-not-send=3D"true"
href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3fbbd6=
b8-9087-4c02-bf66-632b7eff480d%40isocpp.org?utm_medium=3Demail&utm_sour=
ce=3Dfooter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3=
fbbd6b8-9087-4c02-bf66-632b7eff480d%40isocpp.org</a>.<br>
</blockquote>
<p><br>
</p>
</body>
</html>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/7aa018bf-dcaa-6c95-dd64-413990592c37%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7aa018bf-dcaa-6c95-dd64-413990592c37=
%40wanadoo.fr</a>.<br />
--------------D4F2F8D6BC7572938EFADC2F--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Sun, 5 Feb 2017 15:17:48 +0100
Raw View
This is a multi-part message in MIME format.
--------------CEC1AE1C0732D1A7041EAEB5
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 05/02/2017 =C3=A0 13:56, TONGARI J a =C3=A9crit :
> On Sunday, February 5, 2017 at 6:41:36 PM UTC+8, Vicente J. Botet=20
> Escriba wrote:
>
> I'm not saying the feature is not needed. I believe however that
> the proposal needs to compare what it is currently doable.
>
> Couldn't we use the existing language already
>
> |
> template<blahblah..., typename T =3D
> |typenameMetaFunc<blahblah...>::type |>
> T f()// yay!
> {
> // Use `T` from now on...
> }
> |
>
> In this case, it's just an alternative w/o (ab)using the template=20
> param, like how concept-lite tries to eliminate enable_if trick.
Maybe. I'd prefer to have the possibility to use the result type as e.g.=20
decltype(return).
>
> |
> template<blahblah..., typename
> Base=3D|typenameMetaFunc<blahblah...>::type|>
> classDerived:publicBase// yay!
> {
> // Use `Base` from now on...
> }
> |
>
> This does not work if "blahblah...", is actually a template parameter=20
> pack, which has to be the last one.
Right. This are the kind of cases you mush show on your proposal, the=20
cases that cannot be solved with the current languages.
>> In parameter list:
>> |
>> template<blahblah...>
>> voidf(typedefSomeTemplate<blahblah...>T a,T b);// yay!
>> |
>>
> I'm not sure the |blahblahcould be inferred
>
> Do tou mean
>
> |
> |template<class U>
> voidf(U, typedefSomeTemplate<U>T a,T b);
> |
>
>
> I mean something like:
> |
> template<class...Args>
> voidf(typedefstd::tuple<Args...>T a,T b);
>
> f(std::make_tuple(1,2),std::make_tuple(3,4));//Args =3D=3D {int, int}, T=
=20
> =3D=3D std::tuple<int, int>
> |
|template<class...Args>
voidf(std::tuple<Args...>a,decltype(a) b) {
using T =3D decltype(a);
// make use of T
}
I believe I have an idea that could be less cryptic and reuse the=20
current alias.
What about defining some alias at the same level as the requires clasue?
|
|
template<blahblah...>
*|requires using T =3D |**|typenameMetaFunc<blahblah...>::type // let T =3D=
|*
T f()// yay!
{
// Use `T` from now on...
}
|
|
template<blahblah...>
*requires using **|Base=3D|typenameMetaFunc<blahblah...>::type
||*|*|// let Base =3D|*|
classDerived:publicBase// yay!
{
// Use `Base` from now on...
}
|
||template<class...Args>
||*|||requires| ||**|||using T| =3D ||*||||*std**::**tuple**<**Args**...>*
||voidf(T a,T b);
Vicente
||
--=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/63e10ea7-0878-cc71-743f-745d21dd93c8%40wanadoo.f=
r.
--------------CEC1AE1C0732D1A7041EAEB5
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 05/02/2017 =C3=A0 13:56, TONGARI J a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:fc42405f-b5de-492a-9e7e-e191a6dd975c@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">On Sunday, February 5, 2017 at 6:41:36 PM UTC+8,
Vicente J. Botet Escriba wrote:=C2=A0
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>I'm not saying the feature is not needed. I believe
however that the proposal needs to compare what it is
currently doable.<br>
</div>
<br>
Couldn't we use the existing language already<br>
<br>
<div
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>
<div><span style=3D"color:#008">template</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">..., typename T =3D </span><span
style=3D"color:#660"><code><span style=3D"color:#000"><=
/span><span
style=3D"color:#008">typename</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">MetaFunc</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...>::</span><span
style=3D"color:#000">type </span></code>></span>=
<span
style=3D"color:#000"><br>
</span><span style=3D"color:#000">T f</span><span
style=3D"color:#660">()</span><span style=3D"color:#000=
">
</span><span style=3D"color:#800">// yay!</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:#800">// Use =
`T` from
now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
<blockquote type=3D"cite">
<div dir=3D"ltr"> </div>
</blockquote>
</div>
</blockquote>
<div>In this case, it's just an alternative w/o (ab)using the
template param, like how concept-lite tries to eliminate
enable_if trick.</div>
</div>
</blockquote>
Maybe. I'd prefer to have the possibility to use the result type as
e.g. decltype(return).<br>
<blockquote
cite=3D"mid:fc42405f-b5de-492a-9e7e-e191a6dd975c@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>=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 bgcolor=3D"#FFFFFF" text=3D"#000000">
<div
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>
<div><span style=3D"color:#008">template</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">..., typename Base=3D</span><span
style=3D"color:#660"><code><span style=3D"color:#000"><=
/span><span
style=3D"color:#008">typename</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">MetaFunc</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...>::</span><span
style=3D"color:#000">type</span></code>></span><=
span
style=3D"color:#000"><br>
</span><span style=3D"color:#008">class</span><span
style=3D"color:#000"> </span><span style=3D"color:#606"=
>Derived</span><span
style=3D"color:#000"> </span><span style=3D"color:#660"=
>:</span><span
style=3D"color:#000"> </span><span style=3D"color:#000"=
></span><span
style=3D"color:#008">public</span><span
style=3D"color:#000"> </span><span style=3D"color:#000"=
></span><span
style=3D"color:#606">Base</span><span
style=3D"color:#000"> </span><span style=3D"color:#800"=
>//
yay!</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:#800">// Use =
`Base`
from now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
</div>
</blockquote>
<div>=C2=A0</div>
<div>This does not work if "<span style=3D"background-color:
rgb(250, 250, 250); color: rgb(0, 0, 0); font-family:
monospace;">blahblah...</span>", is actually a template
parameter pack, which has to be the last one.</div>
</div>
</blockquote>
Right. This are the kind of cases you mush show on your proposal,
the cases that cannot be solved with the current languages.<br>
<br>
<blockquote
cite=3D"mid:fc42405f-b5de-492a-9e7e-e191a6dd975c@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>In parameter list:</div>
<div
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>
<div><span style=3D"color:#008">template</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...></span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#008">void</span><span
style=3D"color:#000"> f</span><span
style=3D"color:#660">(</span><span
style=3D"color:#008">typedef</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">SomeTemplate</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...></span><span
style=3D"color:#000"> T a</span><span
style=3D"color:#660">,</span><span
style=3D"color:#000"> T b</span><span
style=3D"color:#660">);</span><span
style=3D"color:#000"> </span><span
style=3D"color:#800">// yay!</span></div>
</code></div>
<div><br>
</div>
</div>
</blockquote>
I'm not sure the <code><span style=3D"color:#660"></span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660"> could be inferred<br>
<br>
Do tou mean<br>
<br>
</span></code><br>
<code><span style=3D"color:#008">template</span><span
style=3D"color:#660"><class U</span><span
style=3D"color:#660">></span><span style=3D"color:#000">=
<br>
</span><span style=3D"color:#008">void</span><span
style=3D"color:#000"> f</span><span style=3D"color:#660">(U=
,
</span><span style=3D"color:#008">typedef</span><span
style=3D"color:#000"> </span><span style=3D"color:#606">Som=
eTemplate</span><span
style=3D"color:#660"><</span><span style=3D"color:#000">=
U</span><span
style=3D"color:#660">></span><span style=3D"color:#000">
T a</span><span style=3D"color:#660">,</span><span
style=3D"color:#000"> T b</span><span style=3D"color:#660">=
);<br>
</span></code></div>
</blockquote>
<div><br>
</div>
<div>I mean something like:</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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #008;" class=3D"styled-by-prettify">class</=
span><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: #606;" class=3D"styled-by-prettify">Args</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span
style=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"> f</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">typedef=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify">tuple</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #606;" class=3D"styled-by-prettify">Args</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T a</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T b</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">);</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
<br>
</span><font color=3D"#660066"><span style=3D"color: #000;"
class=3D"styled-by-prettify">f</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"styled-by-prettify">::</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">make_=
tuple</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
style=3D"color: #066;" class=3D"styled-by-prettify">1</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
style=3D"color: #066;" class=3D"styled-by-prettify">2</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">),</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an></font><span
style=3D"color: #000;" class=3D"styled-by-prettify">std</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify">make_tu=
ple</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><font
color=3D"#006666"><span style=3D"color: #066;"
class=3D"styled-by-prettify">3</span><span style=3D"color=
:
#660;" class=3D"styled-by-prettify">,</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
style=3D"color: #066;" class=3D"styled-by-prettify">4</sp=
an></font><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: #800;" class=3D"styled-by-prettify">//Args
=3D=3D {int, int}, T =3D=3D std::tuple<int, int></spa=
n></div>
</code></div>
</div>
</blockquote>
<code class=3D"prettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span style=3D"color:
#660;" 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">...</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span
style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><spa=
n
style=3D"color: #660;" class=3D"styled-by-prettify">></span><spa=
n
style=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"> f</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"styled-by-prettify">::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">tuple</span><sp=
an
style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n
style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><spa=
n
style=3D"color: #660;" class=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-prettify"> decltype(a) b<=
/span><span
style=3D"color: #660;" class=3D"styled-by-prettify">) {<br>
=C2=A0=C2=A0=C2=A0 using T =3D decltype(a);<br>
=C2=A0=C2=A0=C2=A0 // make use of T<br>
}<br>
<br>
I believe I have an idea that could be less cryptic and reuse
the current alias. <br>
What about defining some alias at the same level as the requires
clasue?<br>
<br>
</span></code>
<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"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify">blahblah</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">...></sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><b><code><span style=3D"color:#000">requires using T =3D <=
/span></code></b><b><code
class=3D"prettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">typename</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">MetaFun=
c</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">blahbla=
h</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">...>=
::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">type //
let T =3D</span></code></b><span style=3D"color: #008;"
class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
T
f</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: #800;" class=3D"styled-by-prettify">// yay!</sp=
an><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"styled-by-prettify"><br>
=C2=A0 =C2=A0 </span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// Use `T` from now on...</span><s=
pan
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span></div>
</code></div>
<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div
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>
<div><span style=3D"color:#008">template</span><span
style=3D"color:#660"><</span><span style=3D"color:#000">=
blahblah</span><span
style=3D"color:#660">...</span><span style=3D"color:#660">&=
gt;</span><span
style=3D"color:#000"><br>
<b>requires using </b></span><b><code><span
style=3D"color:#660">Base=3D</span><span
style=3D"color:#660"><code><span style=3D"color:#000"><=
/span><span
style=3D"color:#008">typename</span><span
style=3D"color:#000"> </span><span
style=3D"color:#606">MetaFunc</span><span
style=3D"color:#660"><</span><span
style=3D"color:#000">blahblah</span><span
style=3D"color:#660">...>::</span><span
style=3D"color:#000">type </span></code></span></co=
de></b><code
class=3D"prettyprint"><b><code class=3D"prettyprint"><span
style=3D"color: #000;" class=3D"styled-by-prettify">/=
/
let Base =3D</span></code></b><span style=3D"color:
#008;" class=3D"styled-by-prettify"></span></code><span
style=3D"color:#008"><br>
class</span><span style=3D"color:#000"> </span><span
style=3D"color:#606">Derived</span><span
style=3D"color:#000"> </span><span style=3D"color:#660">:</=
span><span
style=3D"color:#000"> </span><span style=3D"color:#000"></s=
pan><span
style=3D"color:#008">public</span><span style=3D"color:#000=
">
</span><span style=3D"color:#000"></span><span
style=3D"color:#606">Base</span><span style=3D"color:#000">
</span><span style=3D"color:#800">// yay!</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:#800">// Use `Bas=
e` from
now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}<br>
<br>
</span></div>
</code></div>
</div>
</blockquote>
<br>
<code class=3D"prettyprint"><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><span
style=3D"color: #008;" class=3D"styled-by-prettify">template</s=
pan><span
style=3D"color: #660;" 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">...</span><=
span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
style=3D"color: #606;" class=3D"styled-by-prettify">Args</span>=
<span
style=3D"color: #660;" class=3D"styled-by-prettify">><br>
</span></code></span></code><b><code class=3D"prettyprint"><span
style=3D"color: #660;" class=3D"styled-by-prettify"><code
class=3D"prettyprint"><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code><span style=3D"color:#000"=
>requires</span></code>
</span></code></span></code></b><b><code class=3D"prettyprint">=
<span
style=3D"color: #660;" class=3D"styled-by-prettify"><code
class=3D"prettyprint"><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code><span style=3D"color:#000"=
>using=C2=A0
T</span></code> =3D </span></code></span></code></b><code
class=3D"prettyprint"><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><span
style=3D"color: #660;" class=3D"styled-by-prettify"><code
class=3D"prettyprint"><span style=3D"color: #660;"
class=3D"styled-by-prettify"><code class=3D"prettyprint"><b=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">s=
td</span></b><b><span
style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span></b><b><span
style=3D"color: #000;" class=3D"styled-by-prettify">t=
uple</span></b><b><span
style=3D"color: #660;" class=3D"styled-by-prettify">&=
lt;</span></b><b><span
style=3D"color: #606;" class=3D"styled-by-prettify">A=
rgs</span></b><span
style=3D"color: #660;" class=3D"styled-by-prettify"><b>=
....></b><br>
</span><span style=3D"color: #000;"
class=3D"styled-by-prettify"></span></code></span></cod=
e></span><span
style=3D"color: #000;" class=3D"styled-by-prettify"></span><spa=
n
style=3D"color: #008;" class=3D"styled-by-prettify">void</span>=
<span
style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><s=
pan
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify">T a</span><=
span
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"> T b</span>=
<span
style=3D"color: #660;" class=3D"styled-by-prettify">);<br>
<br>
Vicente<br>
<br>
</span></code></span></code>
</body>
</html>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/63e10ea7-0878-cc71-743f-745d21dd93c8%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/63e10ea7-0878-cc71-743f-745d21dd93c8=
%40wanadoo.fr</a>.<br />
--------------CEC1AE1C0732D1A7041EAEB5--
.
Author: TONGARI J <tongari95@gmail.com>
Date: Sun, 5 Feb 2017 17:48:15 -0800 (PST)
Raw View
------=_Part_5100_1198539314.1486345695550
Content-Type: multipart/alternative;
boundary="----=_Part_5101_1188588797.1486345695551"
------=_Part_5101_1188588797.1486345695551
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Sunday, February 5, 2017 at 10:17:51 PM UTC+8, Vicente J. Botet Escriba=
=20
wrote:
>
> Le 05/02/2017 =C3=A0 13:56, TONGARI J a =C3=A9crit :
>
> On Sunday, February 5, 2017 at 6:41:36 PM UTC+8, Vicente J. Botet Escriba=
=20
> wrote: =20
>>
>> I'm not saying the feature is not needed. I believe however that the=20
>> proposal needs to compare what it is currently doable.
>>
>> Couldn't we use the existing language already
>>
>> template<blahblah..., typename T =3D typename MetaFunc<blahblah...>::typ=
e >
>> T f() // yay!
>> {
>> // Use `T` from now on...
>> }
>>
>> In this case, it's just an alternative w/o (ab)using the template param,=
=20
> like how concept-lite tries to eliminate enable_if trick.
>
> Maybe. I'd prefer to have the possibility to use the result type as e.g.=
=20
> decltype(return).
>
I have no problem with decltype(return), but it's a specific solution to a=
=20
single case. If we could have a general solution to all similar cases, I'd=
=20
pursue it.
> =20
>
>> template<blahblah..., typename Base=3Dtypename MetaFunc<blahblah...>::ty=
pe>
>> class Derived : public Base // yay!
>> {
>> // Use `Base` from now on...
>> }
>>
> =20
> This does not work if "blahblah...", is actually a template parameter=20
> pack, which has to be the last one.
>
> Right. This are the kind of cases you mush show on your proposal, the=20
> cases that cannot be solved with the current languages.
>
> I mean something like:
> template<class... Args>
> void f(typedef std::tuple<Args...> T a, T b);
>
> f(std::make_tuple(1, 2), std::make_tuple(3, 4)); //Args =3D=3D {int, int}=
, T=20
> =3D=3D std::tuple<int, int>
>
> template<class... Args>
> void f(std::tuple<Args...> a, decltype(a) b) {
> using T =3D decltype(a);
> // make use of T
> }
>
Even though using decltype may make it shorter, it's still not ideal,=20
suppose you now have more than 2 params not just a & b.
=20
> I believe I have an idea that could be less cryptic and reuse the current=
=20
> alias.=20
> What about defining some alias at the same level as the requires clasue?
>
The crux of the extended typedef is that it allows you to declare both a=20
type and variables at once.
The idea of such a composite declaration is not novel, as in C++ we already=
=20
have:
struct S{} s; // Declares type 'S' and varaible 's'
So I think C++ programmers should be familiar with such a style, and=20
extended typedef is just a natural extension of this style.
The simple type deduction is also an important feature of extended typedef:
typedef auto T& ref =3D getSomeRef(...);=20
otherwise, we have to do more verbose
auto& ref =3D getSomeRef(...);
using T =3D std::remove_reference_t<decltype(ref)>;
>
--=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/e2d22969-1510-448f-acfd-44e421fc300b%40isocpp.or=
g.
------=_Part_5101_1188588797.1486345695551
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, February 5, 2017 at 10:17:51 PM UTC+8, Vicente =
J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>Le 05/02/2017 =C3=A0 13:56, TONGARI J a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">On Sunday, February 5, 2017 at 6:41:36 PM UTC+8,
Vicente J. Botet Escriba wrote:=C2=A0
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>I'm not saying the feature is not needed. I believe
however that the proposal needs to compare what it is
currently doable.<br>
</div>
<br>
Couldn't we use the existing language already<br>
<br>
<div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode>
<div><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">blahblah</span><span =
style=3D"color:#660">..., typename T =3D </span><span style=3D"color:#660">=
<code><span style=3D"color:#000"></span><span style=3D"color:#008">typename=
</span><span style=3D"color:#000"> </span><span style=3D"color:#606">MetaFu=
nc</span><span style=3D"color:#660"><</span><span style=3D"color:#000">b=
lahblah</span><span style=3D"color:#660">...>::</span><span style=3D"col=
or:#000">type </span></code>></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#000">T f</span><span style=
=3D"color:#660">()</span><span style=3D"color:#000">
</span><span style=3D"color:#800">// yay!</span><span sty=
le=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:#800">// Use =
`T` from
now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
<blockquote type=3D"cite">
<div dir=3D"ltr"> </div>
</blockquote>
</div>
</blockquote>
<div>In this case, it's just an alternative w/o (ab)using the
template param, like how concept-lite tries to eliminate
enable_if trick.</div>
</div>
</blockquote>
Maybe. I'd prefer to have the possibility to use the result type as
e.g. decltype(return).<br></div></blockquote><div><br></div><div>I have=
no problem with decltype(return), but it's a specific solution to a si=
ngle=C2=A0case. If we could have a general solution to all similar cases, I=
'd pursue it.</div><blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div bg=
color=3D"#FFFFFF" text=3D"#000000">
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>=C2=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode>
<div><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">blahblah</span><span =
style=3D"color:#660">..., typename Base=3D</span><span style=3D"color:#660"=
><code><span style=3D"color:#000"></span><span style=3D"color:#008">typenam=
e</span><span style=3D"color:#000"> </span><span style=3D"color:#606">MetaF=
unc</span><span style=3D"color:#660"><</span><span style=3D"color:#000">=
blahblah</span><span style=3D"color:#660">...>::</span><span style=3D"co=
lor:#000">type</span></code>></span><span style=3D"color:#000"><br>
</span><span style=3D"color:#008">class</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Derived</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#660">:</span><span style=3D"=
color:#000"> </span><span style=3D"color:#000"></span><span style=3D"color:=
#008">public</span><span style=3D"color:#000"> </span><span style=3D"color:=
#000"></span><span style=3D"color:#606">Base</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#800">//
yay!</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:#800">// Use =
`Base`
from now on...</span><span style=3D"color:#000"><br>
</span><span style=3D"color:#660">}</span></div>
</code></div>
</div>
</blockquote>
<div>=C2=A0</div>
<div>This does not work if "<span style=3D"background-color:rg=
b(250,250,250);color:rgb(0,0,0);font-family:monospace">blahblah...</span>&q=
uot;, is actually a template
parameter pack, which has to be the last one.</div>
</div>
</blockquote>
Right. This are the kind of cases you mush show on your proposal,
the cases that cannot be solved with the current languages.<br><blockqu=
ote type=3D"cite">
<div dir=3D"ltr">
=20
<div>I mean something like:</div>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(18=
7,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>
<div><span style=3D"color:#008">template</span><span style=3D"c=
olor:#660"><</span><span style=3D"color:#008">class</span><span style=3D=
"color:#660">...</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#606">Args</span><span style=3D"color:#660">></span><span style=3D"c=
olor:#000"><br>
</span><span style=3D"color:#008">void</span><span style=3D"c=
olor:#000"> f</span><span style=3D"color:#660">(</span><span style=3D"color=
:#008">typedef</span><span style=3D"color:#000"> std</span><span style=3D"c=
olor:#660">::</span><span style=3D"color:#000">tuple</span><span style=3D"c=
olor:#660"><</span><span style=3D"color:#606">Args</span><span style=3D"=
color:#660">...></span><span style=3D"color:#000"> T a</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> T b</span><span style=
=3D"color:#660">);</span><span style=3D"color:#000"><br>
<br>
</span><font color=3D"#660066"><span style=3D"color:#000">f</=
span><span style=3D"color:#660">(</span><span style=3D"color:#000">std</spa=
n><span style=3D"color:#660">::</span><span style=3D"color:#000">make_tuple=
</span><span style=3D"color:#660">(</span><span style=3D"color:#066">1</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#066">2</span><span style=3D"color:#660">),</span><span s=
tyle=3D"color:#000"> </span></font><span style=3D"color:#000">std</span><sp=
an style=3D"color:#660">::</span><span style=3D"color:#000">make_tuple</spa=
n><span style=3D"color:#660">(</span><font color=3D"#006666"><span style=3D=
"color:#066">3</span><span style=3D"color:#660">,</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#066">4</span></font><span style=3D"co=
lor:#660">));</span><span style=3D"color:#000"> </span><span style=3D"color=
:#800">//Args
=3D=3D {int, int}, T =3D=3D std::tuple<int, int></spa=
n></div>
</code></div>
</div>
</blockquote>
<code><span style=3D"color:#008">template</span><span style=3D"color:#6=
60"><</span><span style=3D"color:#008">class</span><span style=3D"color:=
#660">...</span><span style=3D"color:#000"> </span><span style=3D"color:#60=
6">Args</span><span style=3D"color:#660">></span><span style=3D"color:#0=
00"><br>
</span><span style=3D"color:#008">void</span><span style=3D"color:#00=
0"> f</span><span style=3D"color:#660">(</span><span style=3D"color:#000">s=
td</span><span style=3D"color:#660">::</span><span style=3D"color:#000">tup=
le</span><span style=3D"color:#660"><</span><span style=3D"color:#606">A=
rgs</span><span style=3D"color:#660">...></span><span style=3D"color:#00=
0"> a</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
decltype(a) b</span><span style=3D"color:#660">) {<br>
=C2=A0=C2=A0=C2=A0 using T =3D decltype(a);<br>
=C2=A0=C2=A0=C2=A0 // make use of T<br>
}<br></span></code></div></blockquote><div><br></div><div>Even thou=
gh using =C2=A0<span style=3D"color: rgb(0, 0, 0); font-family: monospace;"=
>decltype</span> may make it shorter, it's still not ideal, suppose you=
now have more than 2 params not just a & b.</div><div>=C2=A0</div><blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#=
000000"><code><span style=3D"color:#660">
I believe I have an idea that could be less cryptic and reuse
the current alias. <br>
What about defining some alias at the same level as the requires
clasue?<br></span></code></div></blockquote><div><br></div><div>The=
crux of the extended typedef is that it allows you to declare both a type =
and variables at once.</div><div>The idea of such a composite declaration i=
s not novel, as in C++ we already have:</div><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;"><co=
de class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color=
: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> S</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> s</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: #800;" class=3D"styled-by-prettify">// Decla=
res type 'S' and varaible 's'</span></div></code></div><br>=
</div><div>So I think C++ programmers should be familiar with such a style,=
and extended typedef is just a natural extension of this style.</div><div>=
<br></div><div>The simple type deduction is also an important feature of ex=
tended typedef:</div><div><div class=3D"prettyprint" style=3D"background-co=
lor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: so=
lid; 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">typedef</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"> T</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">ref</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> getSomeRef</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(...);</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></div></code></div></div><div><br></div><di=
v>otherwise, we have to do more verbose</div><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;"><co=
de class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color=
: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">ref</span><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"> getS=
omeRef</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(...=
);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">using</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> T </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">remove_reference_t</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #008;"=
class=3D"styled-by-prettify">decltype</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">ref</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">)>;</span></div></code></div></div><blockquote class=3D"gmai=
l_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;=
padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
</div>
</blockquote></div>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e2d22969-1510-448f-acfd-44e421fc300b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e2d22969-1510-448f-acfd-44e421fc300b=
%40isocpp.org</a>.<br />
------=_Part_5101_1188588797.1486345695551--
------=_Part_5100_1198539314.1486345695550--
.