Topic: Alternative for auto deduction for temporary types
Author: inkwizytoryankes@gmail.com
Date: Sun, 2 Jul 2017 04:29:13 -0700 (PDT)
Raw View
------=_Part_1371_1203746700.1498994953551
Content-Type: multipart/alternative;
boundary="----=_Part_1372_1311646729.1498994953551"
------=_Part_1372_1311646729.1498994953551
Content-Type: text/plain; charset="UTF-8"
We had couple of discussion about allowing class do change type in `auto`
variable declaration:
auto m = a * b; // `auto m` equal `Matrix m` not
`impl::temp_res_mul<Matrix, Matrix> m`
But in C++17 we have all needed tools to recreate this functionality:
template<typename Tag>
struct LinAlgTemp
{
Tag temp;
LinAlgTemp(Tag a) : temp{ a } { }
};
template<typename Tag>
struct LinAlg
{
Tag v;
LinAlg(Tag a) : v{ a } { }
LinAlg(LinAlgTemp<Tag> a) : v{ a.temp } { }
LinAlgTemp<Tag> operator*(LinAlg<Tag> b) { return { v * b.v }; }
};
int main()
{
LinAlg a = 21;
LinAlg b = 2;
LinAlg c = a * b;
LinAlgTemp d = c * b; //`d` is still temp, useful if you build bigger
expression
return c.v;
}
I think using some thing like `LinAlg` could be more readable than `auto`,
you still not need to know exactly what type you have but you know what
category it is, this in some way similar to concept functionality.
--
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/139441af-adc1-4265-a62b-3952d5b46818%40isocpp.org.
------=_Part_1372_1311646729.1498994953551
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br>We had couple of discussion about allowing class do ch=
ange type in `auto` variable declaration:<br><br><div style=3D"background-c=
olor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: s=
olid; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> m </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">=3D</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-prett=
ify"> b</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">// `auto m` equal `Ma=
trix m` not `impl::temp_res_mul<Matrix, Matrix> m`</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></di=
v><br>But in C++17 we have all needed tools to recreate this functionality:=
<br><br><div style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: b=
reak-word;" class=3D"prettyprint"><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">&l=
t;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Tag</span><span sty=
le=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">struct</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">LinAlgTemp</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Tag</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> temp</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">LinAlgTemp</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Tag</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> temp</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> a </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br></span><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"st=
yled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">Tag</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">struct</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #606;" class=3D"styled-by-prettify">LinAlg</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Tag</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> v</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><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">LinAlg</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Tag</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> a</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 styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> v</span><span style=3D"col=
or: #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"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color: #606;" class=3D"styled-by-prettify">LinAlg</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #606;" class=3D"styled-by-prettify">LinAlgTemp</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"=
color: #606;" class=3D"styled-by-prettify">Tag</span><span 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"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><sp=
an 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">temp </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>LinAlgTemp</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
><</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Tag</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">></span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">*(</span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">LinAlg</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #606;" =
class=3D"styled-by-prettify">Tag</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">return</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"> v </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">v =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> main</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><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: #606;" class=3D"styled-by-prettify">Lin=
Alg</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">21</span><span style=3D"colo=
r: #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=
: #606;" class=3D"styled-by-prettify">LinAlg</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> b </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">=3D</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-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>LinAlg</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> c =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> b</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">LinAlgTemp</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> d </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> c </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> b</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: #800;" class=3D"styled-by-prettify">//`d` is still temp, us=
eful if you build bigger expression</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> c</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">v</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></co=
de></div><br>I think using some thing like `LinAlg` could be more readable =
than `auto`, you still not need to know exactly what type you have but you =
know what category it is, this in some way similar to concept functionality=
..<br><br></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/139441af-adc1-4265-a62b-3952d5b46818%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/139441af-adc1-4265-a62b-3952d5b46818=
%40isocpp.org</a>.<br />
------=_Part_1372_1311646729.1498994953551--
------=_Part_1371_1203746700.1498994953551--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 2 Jul 2017 06:11:25 -0700 (PDT)
Raw View
------=_Part_1313_775564081.1499001085122
Content-Type: multipart/alternative;
boundary="----=_Part_1314_2004387142.1499001085123"
------=_Part_1314_2004387142.1499001085123
Content-Type: text/plain; charset="UTF-8"
On Sunday, July 2, 2017 at 7:29:13 AM UTC-4, Marcin Jaczewski wrote:
>
>
> We had couple of discussion about allowing class do change type in `auto`
> variable declaration:
>
> auto m = a * b; // `auto m` equal `Matrix m` not
> `impl::temp_res_mul<Matrix, Matrix> m`
>
> But in C++17 we have all needed tools to recreate this functionality:
>
> template<typename Tag>
> struct LinAlgTemp
> {
> Tag temp;
> LinAlgTemp(Tag a) : temp{ a } { }
> };
>
> template<typename Tag>
> struct LinAlg
> {
> Tag v;
>
> LinAlg(Tag a) : v{ a } { }
> LinAlg(LinAlgTemp<Tag> a) : v{ a.temp } { }
>
> LinAlgTemp<Tag> operator*(LinAlg<Tag> b) { return { v * b.v }; }
> };
>
> int main()
> {
> LinAlg a = 21;
> LinAlg b = 2;
> LinAlg c = a * b;
> LinAlgTemp d = c * b; //`d` is still temp, useful if you build bigger
> expression
> return c.v;
> }
>
> I think using some thing like `LinAlg` could be more readable than `auto`,
>
Regardless of whether that's true or not, the entire purpose of P0672
<http://wg21.link/P0672>is to handle cases where `auto` is used. Telling
people not to use `auto` in these cases is merely just what we've been
telling people since C++11. C++17's constructor deduction may make the
typename shorter, but you're still using a typename.
Also, you're bloating your types. `LinAlgTemp` has an empty `Tag` member;
it takes up space in the class's layout.
> you still not need to know exactly what type you have but you know what
> category it is, this in some way similar to concept functionality.
>
--
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/a8b08e99-a9fc-4ea6-bb68-df650673ffdf%40isocpp.org.
------=_Part_1314_2004387142.1499001085123
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, July 2, 2017 at 7:29:13 AM UTC-4, Marcin Jaczew=
ski wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br=
>We had couple of discussion about allowing class do change type in `auto` =
variable declaration:<br><br><div style=3D"background-color:rgb(250,250,250=
);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><code>=
<div><span style=3D"color:#008">auto</span><span style=3D"color:#000"> m </=
span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> a </s=
pan><span style=3D"color:#660">*</span><span style=3D"color:#000"> b</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"> </span><span=
style=3D"color:#800">// `auto m` equal `Matrix m` not `impl::temp_res_mul&=
lt;Matrix, Matrix> m`</span><span style=3D"color:#000"><br></span></div>=
</code></div><br>But in C++17 we have all needed tools to recreate this fun=
ctionality:<br><br><div style=3D"background-color:rgb(250,250,250);border-c=
olor:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span=
style=3D"color:#008">template</span><span style=3D"color:#660"><</span>=
<span style=3D"color:#008">typename</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#606">Tag</span><span style=3D"color:#660">></spa=
n><span style=3D"color:#000"><br></span><span style=3D"color:#008">struct</=
span><span style=3D"color:#000"> </span><span style=3D"color:#606">LinAlgTe=
mp</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"c=
olor:#606">Tag</span><span style=3D"color:#000"> temp</span><span style=3D"=
color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color:#606">LinAlgTemp</span><span style=3D"color:#660">(</span=
><span style=3D"color:#606">Tag</span><span style=3D"color:#000"> a</span><=
span style=3D"color:#660">)</span><span style=3D"color:#000"> </span><span =
style=3D"color:#660">:</span><span style=3D"color:#000"> temp</span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"> a </span><span styl=
e=3D"color:#660">}</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">{</span><span style=3D"color:#000"> </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><br></span><span style=3D"colo=
r:#008">template</span><span style=3D"color:#660"><</span><span style=3D=
"color:#008">typename</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Tag</span><span style=3D"color:#660">></span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#606">LinAlg</span><span st=
yle=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">Tag</s=
pan><span style=3D"color:#000"> v</span><span style=3D"color:#660">;</span>=
<span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"colo=
r:#606">LinAlg</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#606">Tag</span><span style=3D"color:#000"> a</span><span style=3D"color:=
#660">)</span><span style=3D"color:#000"> </span><span style=3D"color:#660"=
>:</span><span style=3D"color:#000"> v</span><span style=3D"color:#660">{</=
span><span style=3D"color:#000"> a </span><span style=3D"color:#660">}</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">{</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">LinA=
lg</span><span style=3D"color:#660">(</span><span style=3D"color:#606">LinA=
lgTemp</span><span style=3D"color:#660"><</span><span style=3D"color:#60=
6">Tag</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"> =
</span><span style=3D"color:#660">:</span><span style=3D"color:#000"> v</sp=
an><span style=3D"color:#660">{</span><span style=3D"color:#000"> a</span><=
span style=3D"color:#660">.</span><span style=3D"color:#000">temp </span><s=
pan style=3D"color:#660">}</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">}</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </=
span><span style=3D"color:#606">LinAlgTemp</span><span style=3D"color:#660"=
><</span><span style=3D"color:#606">Tag</span><span style=3D"color:#660"=
>></span><span style=3D"color:#000"> </span><span style=3D"color:#008">o=
perator</span><span style=3D"color:#660">*(</span><span style=3D"color:#606=
">LinAlg</span><span style=3D"color:#660"><</span><span style=3D"color:#=
606">Tag</span><span style=3D"color:#660">></span><span style=3D"color:#=
000"> b</span><span style=3D"color:#660">)</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">return</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">{</span><span style=3D"color:#000"> v </span=
><span style=3D"color:#660">*</span><span style=3D"color:#000"> b</span><sp=
an style=3D"color:#660">.</span><span style=3D"color:#000">v </span><span s=
tyle=3D"color:#660">};</span><span style=3D"color:#000"> </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><br></span><span st=
yle=3D"color:#008">int</span><span style=3D"color:#000"> main</span><span s=
tyle=3D"color:#660">()</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:#606">LinAlg</span><span style=3D"color:#000"> a <=
/span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#066">21</span><span style=3D"color:#660">;</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#60=
6">LinAlg</span><span style=3D"color:#000"> b </span><span style=3D"color:#=
660">=3D</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"><br=
>=C2=A0 =C2=A0 </span><span style=3D"color:#606">LinAlg</span><span style=
=3D"color:#000"> c </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> a </span><span style=3D"color:#660">*</span><span style=3D=
"color:#000"> b</span><span style=3D"color:#660">;</span><span style=3D"col=
or:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">LinAlgTemp</sp=
an><span style=3D"color:#000"> d </span><span style=3D"color:#660">=3D</spa=
n><span style=3D"color:#000"> c </span><span style=3D"color:#660">*</span><=
span style=3D"color:#000"> b</span><span style=3D"color:#660">;</span><span=
style=3D"color:#000"> </span><span style=3D"color:#800">//`d` is still tem=
p, useful if you build bigger expression</span><span style=3D"color:#000"><=
br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">return</span><span style=
=3D"color:#000"> c</span><span style=3D"color:#660">.</span><span style=3D"=
color:#000">v</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></span></div></code></div><br>I think using some thing like `LinAl=
g` could be more readable than `auto`,</div></blockquote><div><br>Regardles=
s of whether that's true or not, the entire purpose of <a href=3D"http:=
//wg21.link/P0672">P0672 </a>is to handle cases where `auto` is used. Telli=
ng people not to use `auto` in these cases is merely just what we've be=
en telling people since C++11. C++17's constructor deduction may make t=
he typename shorter, but you're still using a typename.<br><br>Also, yo=
u're bloating your types. `LinAlgTemp` has an empty `Tag` member; it ta=
kes up space in the class's layout.<br>=C2=A0</div><blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;"><div dir=3D"ltr">you still not need to know exactl=
y what type you have but you know what category it is, this in some way sim=
ilar to concept functionality.<br></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/a8b08e99-a9fc-4ea6-bb68-df650673ffdf%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a8b08e99-a9fc-4ea6-bb68-df650673ffdf=
%40isocpp.org</a>.<br />
------=_Part_1314_2004387142.1499001085123--
------=_Part_1313_775564081.1499001085122--
.
Author: inkwizytoryankes@gmail.com
Date: Sun, 2 Jul 2017 06:46:58 -0700 (PDT)
Raw View
------=_Part_756_283077948.1499003218692
Content-Type: multipart/alternative;
boundary="----=_Part_757_501027932.1499003218693"
------=_Part_757_501027932.1499003218693
Content-Type: text/plain; charset="UTF-8"
On Sunday, July 2, 2017 at 3:11:25 PM UTC+2, Nicol Bolas wrote:
> I think using some thing like `LinAlg` could be more readable than `auto`,
>>
>
> Regardless of whether that's true or not, the entire purpose of P0672
> <http://www.google.com/url?q=http%3A%2F%2Fwg21.link%2FP0672&sa=D&sntz=1&usg=AFQjCNGCoEIQNzPBDopELkCdvQJAydjQrA>is
> to handle cases where `auto` is used. Telling people not to use `auto` in
> these cases is merely just what we've been telling people since C++11.
> C++17's constructor deduction may make the typename shorter, but you're
> still using a typename.
>
>
But this case typename will work like auto. this isn't solution for whole
langue but one library that have problem with current `auto`.
I simply saw new usage that could be used to solve problems that currently
we have. At least it could be worth for consideration in evaluation of
original proposal.
> Also, you're bloating your types. `LinAlgTemp` has an empty `Tag` member;
> it takes up space in the class's layout.
>
This this only for showing idea not how to implements it, if you look
closer you will see that I use shortcut and treat tag as type of value.
Another thing is that temp have result not arguments, but again I tried
show idea of iteration of different types that correctly implementing
linear algebra classes.
--
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/e102c1cd-17d5-4f83-bbf1-9cd70603e577%40isocpp.org.
------=_Part_757_501027932.1499003218693
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Sunday, July 2, 2017 at 3:11:25 PM UTC+2, Nicol=
Bolas wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I think using =
some thing like `LinAlg` could be more readable than `auto`,</div></blockqu=
ote><div><br>Regardless of whether that's true or not, the entire purpo=
se of <a href=3D"http://www.google.com/url?q=3Dhttp%3A%2F%2Fwg21.link%2FP06=
72&sa=3DD&sntz=3D1&usg=3DAFQjCNGCoEIQNzPBDopELkCdvQJAydjQrA" ta=
rget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Fwg21.link%2FP0672\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNGCoEIQNzPBDopELkCdvQJAydjQrA';return true;" onclick=3D=
"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwg21.link%2FP=
0672\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGCoEIQNzPBDopELkCdvQJAydjQrA&#=
39;;return true;">P0672 </a>is to handle cases where `auto` is used. Tellin=
g people not to use `auto` in these cases is merely just what we've bee=
n telling people since C++11. C++17's constructor deduction may make th=
e typename shorter, but you're still using a typename.<br><br></div></d=
iv></blockquote><div><br>But this case typename will work like auto. this i=
sn't solution for whole langue but one library that have problem with c=
urrent `auto`.<br>I simply saw new usage that could be used to solve proble=
ms that currently we have. At least it could be worth for consideration in =
evaluation of original proposal.<br>=C2=A0</div><blockquote class=3D"gmail_=
quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pa=
dding-left: 1ex;"><div><div>Also, you're bloating your types. `LinAlgTe=
mp` has an empty `Tag` member; it takes up space in the class's layout.=
=C2=A0</div></div></blockquote><div><br>This this only for showing idea not=
how to implements it, if you look closer you will see that I use shortcut =
and treat tag as type of value.<br>Another thing is that temp have result n=
ot arguments, but again I tried show idea of iteration of different types t=
hat correctly implementing linear algebra classes.<br></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/e102c1cd-17d5-4f83-bbf1-9cd70603e577%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e102c1cd-17d5-4f83-bbf1-9cd70603e577=
%40isocpp.org</a>.<br />
------=_Part_757_501027932.1499003218693--
------=_Part_756_283077948.1499003218692--
.