Topic: Conversion from lvalue to rvalue


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Mon, 5 Oct 2015 13:24:38 -0700 (PDT)
Raw View
------=_Part_579_437436720.1444076678851
Content-Type: multipart/alternative;
 boundary="----=_Part_580_478032097.1444076678851"

------=_Part_580_478032097.1444076678851
Content-Type: text/plain; charset=UTF-8

One of methods to convert lvalue to rvalue is to use the functional of
explicit conversion.

Compare these two examples

//...

int main()
{
{
    int a = 10;
    int b = 5;

    std::tie( a, b ) = std::minmax( a, b );
    std::cout << "a = " << a << ", b = " << b << std::endl;
}
{
    int a = 10;
    int b = 5;

    std::tie( a, b ) = std::minmax( int { a }, int { b } );
    std::cout << "a = " << a << ", b = " << b << std::endl;
}
}

The out put correspondingly is

a = 5, b = 5
a = 5, b = 10

I am suggesting to use the following general syntax

    std::tie( a, b ) = std::minmax( auto( a ), auto( b ) );

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr"><div>One of methods to convert=C2=A0lvalue to rvalue is to=
 use the functional of explicit conversion.</div><div><br></div><div>Compar=
e these two examples</div><div><br></div><div>//...</div><div><br></div><di=
v>int main()<br>{<br>{<br>=C2=A0=C2=A0=C2=A0 int a =3D 10;<br>=C2=A0=C2=A0=
=C2=A0 int b =3D 5;<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 std::tie( =
a, b ) =3D std::minmax( a, b );<br>=C2=A0=C2=A0=C2=A0 std::cout &lt;&lt; &q=
uot;a =3D &quot; &lt;&lt; a &lt;&lt; &quot;, b =3D &quot; &lt;&lt; b &lt;&l=
t; std::endl;<br>}<br>{<br>=C2=A0=C2=A0=C2=A0 int a =3D 10;<br>=C2=A0=C2=A0=
=C2=A0 int b =3D 5;<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 std::tie( =
a, b ) =3D std::minmax( int { a }, int { b } );<br>=C2=A0=C2=A0=C2=A0 std::=
cout &lt;&lt; &quot;a =3D &quot; &lt;&lt; a &lt;&lt; &quot;, b =3D &quot; &=
lt;&lt; b &lt;&lt; std::endl;<br>}<br>}</div><div><br></div><div>The out=C2=
=A0put correspondingly is</div><div><br></div><div>a =3D 5, b =3D 5<br>a =
=3D 5, b =3D 10</div><div><br></div><div>I am suggesting to use the followi=
ng general syntax</div><div><br></div><div>=C2=A0=C2=A0=C2=A0 std::tie( a, =
b ) =3D std::minmax(=C2=A0auto( a ),=C2=A0auto( b=C2=A0) );<br><br></div></=
div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_580_478032097.1444076678851--
------=_Part_579_437436720.1444076678851--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 5 Oct 2015 14:12:22 -0700 (PDT)
Raw View
------=_Part_832_1673001065.1444079542262
Content-Type: multipart/alternative;
 boundary="----=_Part_833_1477843509.1444079542263"

------=_Part_833_1477843509.1444079542263
Content-Type: text/plain; charset=UTF-8



On Monday, October 5, 2015 at 4:24:39 PM UTC-4, Vlad from Moscow wrote:
>
> I am suggesting to use the following general syntax
>
>     std::tie( a, b ) = std::minmax( auto( a ), auto( b ) );
>

So you want `auto(a)` to result in a temporary that is copy/move
constructed from `a`, with the type having been deduced from the type of
`a` (minus references of course). You want a shorthand for:

std::remove_reference_t<decltype(a)>(a)

Your basic problem in this case is that fact that the destination function
was taking and returning references to the parameters, and you were trying
to store those values in the variables being referenced. Your solution is
to create a pair of temporaries, pass them, and copy the temporaries back
into your variables.

Or... you could just create variables. You could even use `auto newA = a`
to create it. And you can use scoping to make them temporary:

{
  auto oldA = a, oldB = b;
  std::tie( a, b ) = std::minmax( oldA, oldB );
}

Is this something we really need to modify the language to do? Is it common
enough that we need specialized syntax to solve it?

Do you have any other use cases for such 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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr"><br><br>On Monday, October 5, 2015 at 4:24:39 PM UTC-4, Vl=
ad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"></div></blockquote><blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv dir=3D"ltr"><div></div><div>I am suggesting to use the following general=
 syntax</div><div><br></div><div>=C2=A0=C2=A0=C2=A0 std::tie( a, b ) =3D st=
d::minmax(=C2=A0auto( a ),=C2=A0auto( b=C2=A0) );<br></div></div></blockquo=
te><div><br>So you want `auto(a)` to result in a temporary that is copy/mov=
e constructed from `a`, with the type having been deduced from the type of =
`a` (minus references of course). You want a shorthand for:<br><br><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: #000;" class=3D"styled-by-prettify">std</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">remove_reference_t</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">decltype</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">)&gt;(</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">a</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">)</span></div></code></div><br>Your basic problem in this case i=
s that fact that the destination function was taking and returning referenc=
es to the parameters, and you were trying to store those values in the vari=
ables being referenced. Your solution is to create a pair of temporaries, p=
ass them, and copy the temporaries back into your variables.<br><br>Or... y=
ou could just create variables. You could even use `auto newA =3D a` to cre=
ate it. And you can use scoping to make them temporary:<br><br><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> oldA </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 style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> oldB </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> b</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 st=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">tie</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> b </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: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">minmax</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> oldA</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> oldB </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styl=
ed-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></span></div></code></div><br>Is this something we really need to modi=
fy the language to do? Is it common enough that we need specialized syntax =
to solve it?<br><br>Do you have any other use cases for such functionality?=
<br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_833_1477843509.1444079542263--
------=_Part_832_1673001065.1444079542262--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Mon, 5 Oct 2015 14:33:15 -0700 (PDT)
Raw View
------=_Part_2048_845598811.1444080795996
Content-Type: multipart/alternative;
 boundary="----=_Part_2049_166342910.1444080795997"

------=_Part_2049_166342910.1444080795997
Content-Type: text/plain; charset=UTF-8



On Tuesday, October 6, 2015 at 12:12:22 AM UTC+3, Nicol Bolas wrote:
>
>
>
> On Monday, October 5, 2015 at 4:24:39 PM UTC-4, Vlad from Moscow wrote:
>>
>> I am suggesting to use the following general syntax
>>
>>     std::tie( a, b ) = std::minmax( auto( a ), auto( b ) );
>>
>
> So you want `auto(a)` to result in a temporary that is copy/move
> constructed from `a`, with the type having been deduced from the type of
> `a` (minus references of course). You want a shorthand for:
>
> std::remove_reference_t<decltype(a)>(a)
>
> Your basic problem in this case is that fact that the destination function
> was taking and returning references to the parameters, and you were trying
> to store those values in the variables being referenced. Your solution is
> to create a pair of temporaries, pass them, and copy the temporaries back
> into your variables.
>
> Or... you could just create variables. You could even use `auto newA = a`
> to create it. And you can use scoping to make them temporary:
>
> {
>   auto oldA = a, oldB = b;
>   std::tie( a, b ) = std::minmax( oldA, oldB );
> }
>
> Is this something we really need to modify the language to do? Is it
> common enough that we need specialized syntax to solve it?
>
> Do you have any other use cases for such functionality?
>


I showed I bad example. I wanted to demonstrate just the idea.

Here is a correct example

    std::vector<int> v = { 1, 2, 3, 7, 1, 5, 4 };

    v.erase( std::remove( v.begin(), v.end(), auto( v[0] ) ), v.end() );

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<br><br>On Tuesday, October 6, 2015 at 12:12:22 AM UTC+3, Nicol Bolas wrote=
:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padd=
ing-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1p=
x; border-left-style: solid;"><div dir=3D"ltr"><br><br>On Monday, October 5=
, 2015 at 4:24:39 PM UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-lef=
t-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: sol=
id;"><div dir=3D"ltr"></div></blockquote><blockquote class=3D"gmail_quote" =
style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: r=
gb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div =
dir=3D"ltr"><div></div><div>I am suggesting to use the following general sy=
ntax</div><div><br></div><div>=C2=A0=C2=A0=C2=A0 std::tie( a, b ) =3D std::=
minmax(=C2=A0auto( a ),=C2=A0auto( b=C2=A0) );<br></div></div></blockquote>=
<div><br>So you want `auto(a)` to result in a temporary that is copy/move c=
onstructed from `a`, with the type having been deduced from the type of `a`=
 (minus references of course). You want a shorthand for:<br><br><div style=
=3D"border: 1px solid rgb(187, 187, 187); border-image: none; -ms-word-wrap=
: break-word; background-color: rgb(250, 250, 250);"><code><div><span style=
=3D"color: rgb(0, 0, 0);">std</span><span style=3D"color: rgb(102, 102, 0);=
">::</span><span style=3D"color: rgb(0, 0, 0);">remove_reference_t</span><s=
pan style=3D"color: rgb(102, 102, 0);">&lt;</span><span style=3D"color: rgb=
(0, 0, 136);">declty<wbr>pe</span><span style=3D"color: rgb(102, 102, 0);">=
(</span><span style=3D"color: rgb(0, 0, 0);">a</span><span style=3D"color: =
rgb(102, 102, 0);">)&gt;(</span><span style=3D"color: rgb(0, 0, 0);">a</spa=
n><span style=3D"color: rgb(102, 102, 0);">)</span></div></code></div><br>Y=
our basic problem in this case is that fact that the destination function w=
as taking and returning references to the parameters, and you were trying t=
o store those values in the variables being referenced. Your solution is to=
 create a pair of temporaries, pass them, and copy the temporaries back int=
o your variables.<br><br>Or... you could just create variables. You could e=
ven use `auto newA =3D a` to create it. And you can use scoping to make the=
m temporary:<br><br><div style=3D"border: 1px solid rgb(187, 187, 187); bor=
der-image: none; -ms-word-wrap: break-word; background-color: rgb(250, 250,=
 250);"><code><div><span style=3D"color: rgb(102, 102, 0);">{</span><span s=
tyle=3D"color: rgb(0, 0, 0);"><br>=C2=A0 </span><span style=3D"color: rgb(0=
, 0, 136);">auto</span><span style=3D"color: rgb(0, 0, 0);"> oldA </span><s=
pan style=3D"color: rgb(102, 102, 0);">=3D</span><span style=3D"color: rgb(=
0, 0, 0);"> a</span><span style=3D"color: rgb(102, 102, 0);">,</span><span =
style=3D"color: rgb(0, 0, 0);"> oldB </span><span style=3D"color: rgb(102, =
102, 0);">=3D</span><span style=3D"color: rgb(0, 0, 0);"> b</span><span sty=
le=3D"color: rgb(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0, 0);=
"><br>=C2=A0 std</span><span style=3D"color: rgb(102, 102, 0);">::</span><s=
pan style=3D"color: rgb(0, 0, 0);">tie</span><span style=3D"color: rgb(102,=
 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0);"> a</span><span styl=
e=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"=
> b </span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"=
color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">=3D<=
/span><span style=3D"color: rgb(0, 0, 0);"> std</span><span style=3D"color:=
 rgb(102, 102, 0);">::</span><span style=3D"color: rgb(0, 0, 0);">minmax</s=
pan><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: =
rgb(0, 0, 0);"> oldA</span><span style=3D"color: rgb(102, 102, 0);">,</span=
><span style=3D"color: rgb(0, 0, 0);"> oldB </span><span style=3D"color: rg=
b(102, 102, 0);">);</span><span style=3D"color: rgb(0, 0, 0);"><br></span><=
span style=3D"color: rgb(102, 102, 0);">}</span><span style=3D"color: rgb(0=
, 0, 0);"><br></span></div></code></div><br>Is this something we really nee=
d to modify the language to do? Is it common enough that we need specialize=
d syntax to solve it?<br><br>Do you have any other use cases for such funct=
ionality?<br></div></div></blockquote><div><br></div><div><br></div><div>I =
showed I bad example.=C2=A0I wanted to demonstrate just the idea.</div><div=
><br></div><div>Here is=C2=A0a correct example </div><div><br></div><div>=
=C2=A0=C2=A0=C2=A0 std::vector&lt;int&gt; v =3D { 1, 2, 3, 7, 1, 5, 4 };=C2=
=A0<br>=C2=A0=C2=A0<br>=C2=A0=C2=A0=C2=A0 v.erase( std::remove( v.begin(), =
v.end(), auto( v[0] )=C2=A0), v.end() );=C2=A0=C2=A0</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_2049_166342910.1444080795997--
------=_Part_2048_845598811.1444080795996--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Mon, 5 Oct 2015 14:37:59 -0700 (PDT)
Raw View
------=_Part_3934_1473409605.1444081079692
Content-Type: multipart/alternative;
 boundary="----=_Part_3935_1237243814.1444081079692"

------=_Part_3935_1237243814.1444081079692
Content-Type: text/plain; charset=UTF-8



On Tuesday, October 6, 2015 at 12:33:16 AM UTC+3, Vlad from Moscow wrote:
>
>
>
> On Tuesday, October 6, 2015 at 12:12:22 AM UTC+3, Nicol Bolas wrote:
>>
>>
>>
>> On Monday, October 5, 2015 at 4:24:39 PM UTC-4, Vlad from Moscow wrote:
>>>
>>> I am suggesting to use the following general syntax
>>>
>>>     std::tie( a, b ) = std::minmax( auto( a ), auto( b ) );
>>>
>>
>> So you want `auto(a)` to result in a temporary that is copy/move
>> constructed from `a`, with the type having been deduced from the type of
>> `a` (minus references of course). You want a shorthand for:
>>
>> std::remove_reference_t<decltype(a)>(a)
>>
>> Your basic problem in this case is that fact that the destination
>> function was taking and returning references to the parameters, and you
>> were trying to store those values in the variables being referenced. Your
>> solution is to create a pair of temporaries, pass them, and copy the
>> temporaries back into your variables.
>>
>> Or... you could just create variables. You could even use `auto newA = a`
>> to create it. And you can use scoping to make them temporary:
>>
>> {
>>   auto oldA = a, oldB = b;
>>   std::tie( a, b ) = std::minmax( oldA, oldB );
>> }
>>
>> Is this something we really need to modify the language to do? Is it
>> common enough that we need specialized syntax to solve it?
>>
>> Do you have any other use cases for such functionality?
>>
>
>
> I showed I bad example. I wanted to demonstrate just the idea.
>
> Here is a correct example
>
>     std::vector<int> v = { 1, 2, 3, 7, 1, 5, 4 };
>
>     v.erase( std::remove( v.begin(), v.end(), auto( v[0] ) ), v.end() );
>


That is the idea is to do the conversion on the fly without using compound
expressions.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<br><br>On Tuesday, October 6, 2015 at 12:33:16 AM UTC+3, Vlad from Moscow =
wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex;=
 padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-widt=
h: 1px; border-left-style: solid;"><br><br>On Tuesday, October 6, 2015 at 1=
2:12:22 AM UTC+3, Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(20=
4, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=
=3D"ltr"><br><br>On Monday, October 5, 2015 at 4:24:39 PM UTC-4, Vlad from =
Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px=
 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-le=
ft-width: 1px; border-left-style: solid;"><div dir=3D"ltr"></div></blockquo=
te><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; pa=
dding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: =
1px; border-left-style: solid;"><div dir=3D"ltr"><div></div><div>I am sugge=
sting to use the following general syntax</div><div><br></div><div>=C2=A0=
=C2=A0=C2=A0 std::tie( a, b ) =3D std::minmax(=C2=A0auto( a ),=C2=A0auto( b=
=C2=A0) );<br></div></div></blockquote><div><br>So you want `auto(a)` to re=
sult in a temporary that is copy/move constructed from `a`, with the type h=
aving been deduced from the type of `a` (minus references of course). You w=
ant a shorthand for:<br><br><div style=3D"border: 1px solid rgb(187, 187, 1=
87); border-image: none; background-color: rgb(250, 250, 250);"><code><div>=
<span style=3D"color: rgb(0, 0, 0);">std</span><span style=3D"color: rgb(10=
2, 102, 0);">::</span><span style=3D"color: rgb(0, 0, 0);">remove_reference=
_t</span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><span style=3D=
"color: rgb(0, 0, 136);">declty<wbr>pe</span><span style=3D"color: rgb(102,=
 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0);">a</span><span style=
=3D"color: rgb(102, 102, 0);">)&gt;(</span><span style=3D"color: rgb(0, 0, =
0);">a</span><span style=3D"color: rgb(102, 102, 0);">)</span></div></code>=
</div><br>Your basic problem in this case is that fact that the destination=
 function was taking and returning references to the parameters, and you we=
re trying to store those values in the variables being referenced. Your sol=
ution is to create a pair of temporaries, pass them, and copy the temporari=
es back into your variables.<br><br>Or... you could just create variables. =
You could even use `auto newA =3D a` to create it. And you can use scoping =
to make them temporary:<br><br><div style=3D"border: 1px solid rgb(187, 187=
, 187); border-image: none; background-color: rgb(250, 250, 250);"><code><d=
iv><span style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"color: r=
gb(0, 0, 0);"><br>=C2=A0 </span><span style=3D"color: rgb(0, 0, 136);">auto=
</span><span style=3D"color: rgb(0, 0, 0);"> oldA </span><span style=3D"col=
or: rgb(102, 102, 0);">=3D</span><span style=3D"color: rgb(0, 0, 0);"> a</s=
pan><span style=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: =
rgb(0, 0, 0);"> oldB </span><span style=3D"color: rgb(102, 102, 0);">=3D</s=
pan><span style=3D"color: rgb(0, 0, 0);"> b</span><span style=3D"color: rgb=
(102, 102, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 std=
</span><span style=3D"color: rgb(102, 102, 0);">::</span><span style=3D"col=
or: rgb(0, 0, 0);">tie</span><span style=3D"color: rgb(102, 102, 0);">(</sp=
an><span style=3D"color: rgb(0, 0, 0);"> a</span><span style=3D"color: rgb(=
102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> b </span><span=
 style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0,=
 0);"> </span><span style=3D"color: rgb(102, 102, 0);">=3D</span><span styl=
e=3D"color: rgb(0, 0, 0);"> std</span><span style=3D"color: rgb(102, 102, 0=
);">::</span><span style=3D"color: rgb(0, 0, 0);">minmax</span><span style=
=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0);">=
 oldA</span><span style=3D"color: rgb(102, 102, 0);">,</span><span style=3D=
"color: rgb(0, 0, 0);"> oldB </span><span style=3D"color: rgb(102, 102, 0);=
">);</span><span style=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"c=
olor: rgb(102, 102, 0);">}</span><span style=3D"color: rgb(0, 0, 0);"><br><=
/span></div></code></div><br>Is this something we really need to modify the=
 language to do? Is it common enough that we need specialized syntax to sol=
ve it?<br><br>Do you have any other use cases for such functionality?<br></=
div></div></blockquote><div><br></div><div><br></div><div>I showed I bad ex=
ample.=C2=A0I wanted to demonstrate just the idea.</div><div><br></div><div=
>Here is=C2=A0a correct example </div><div><br></div><div>=C2=A0=C2=A0=C2=
=A0 std::vector&lt;int&gt; v =3D { 1, 2, 3, 7, 1, 5, 4 };=C2=A0<br>=C2=A0=
=C2=A0<br>=C2=A0=C2=A0=C2=A0 v.erase( std::remove( v.begin(), v.end(), auto=
( v[0] )=C2=A0), v.end() );=C2=A0=C2=A0</div></blockquote><div><br></div><d=
iv><br></div><div>That is the idea is to do the conversion on the fly witho=
ut using compound expressions.=C2=A0</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_3935_1237243814.1444081079692--
------=_Part_3934_1473409605.1444081079692--

.


Author: "T. C." <rs2740@gmail.com>
Date: Mon, 5 Oct 2015 17:12:57 -0700 (PDT)
Raw View
------=_Part_0_2130957191.1444090377381
Content-Type: multipart/alternative;
 boundary="----=_Part_1_1734711264.1444090377389"

------=_Part_1_1734711264.1444090377389
Content-Type: text/plain; charset=UTF-8

http://cplusplus.github.io/EWG/ewg-active.html#188

Although LWG might get to it first with decay_copy.

On Monday, October 5, 2015 at 5:38:00 PM UTC-4, Vlad from Moscow wrote:
>
>
>
> On Tuesday, October 6, 2015 at 12:33:16 AM UTC+3, Vlad from Moscow wrote:
>>
>>
>>
>> On Tuesday, October 6, 2015 at 12:12:22 AM UTC+3, Nicol Bolas wrote:
>>>
>>>
>>>
>>> On Monday, October 5, 2015 at 4:24:39 PM UTC-4, Vlad from Moscow wrote:
>>>>
>>>> I am suggesting to use the following general syntax
>>>>
>>>>     std::tie( a, b ) = std::minmax( auto( a ), auto( b ) );
>>>>
>>>
>>> So you want `auto(a)` to result in a temporary that is copy/move
>>> constructed from `a`, with the type having been deduced from the type of
>>> `a` (minus references of course). You want a shorthand for:
>>>
>>> std::remove_reference_t<decltype(a)>(a)
>>>
>>> Your basic problem in this case is that fact that the destination
>>> function was taking and returning references to the parameters, and you
>>> were trying to store those values in the variables being referenced. Your
>>> solution is to create a pair of temporaries, pass them, and copy the
>>> temporaries back into your variables.
>>>
>>> Or... you could just create variables. You could even use `auto newA =
>>> a` to create it. And you can use scoping to make them temporary:
>>>
>>> {
>>>   auto oldA = a, oldB = b;
>>>   std::tie( a, b ) = std::minmax( oldA, oldB );
>>> }
>>>
>>> Is this something we really need to modify the language to do? Is it
>>> common enough that we need specialized syntax to solve it?
>>>
>>> Do you have any other use cases for such functionality?
>>>
>>
>>
>> I showed I bad example. I wanted to demonstrate just the idea.
>>
>> Here is a correct example
>>
>>     std::vector<int> v = { 1, 2, 3, 7, 1, 5, 4 };
>>
>>     v.erase( std::remove( v.begin(), v.end(), auto( v[0] ) ), v.end() );
>>
>
>
> That is the idea is to do the conversion on the fly without using compound
> expressions.
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr">http://cplusplus.github.io/EWG/ewg-active.html#188<div><br=
></div><div>Although LWG might get to it first with decay_copy.<br><div><br=
>On Monday, October 5, 2015 at 5:38:00 PM UTC-4, Vlad from Moscow wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border=
-left: 1px #ccc solid;padding-left: 1ex;"><br><br>On Tuesday, October 6, 20=
15 at 12:33:16 AM UTC+3, Vlad from Moscow wrote:<blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color=
:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><br><br>On=
 Tuesday, October 6, 2015 at 12:12:22 AM UTC+3, Nicol Bolas wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex=
;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style=
:solid"><div dir=3D"ltr"><br><br>On Monday, October 5, 2015 at 4:24:39 PM U=
TC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);b=
order-left-width:1px;border-left-style:solid"><div dir=3D"ltr"></div></bloc=
kquote><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;b=
order-left-style:solid"><div dir=3D"ltr"><div></div><div>I am suggesting to=
 use the following general syntax</div><div><br></div><div>=C2=A0=C2=A0=C2=
=A0 std::tie( a, b ) =3D std::minmax(=C2=A0auto( a ),=C2=A0auto( b=C2=A0) )=
;<br></div></div></blockquote><div><br>So you want `auto(a)` to result in a=
 temporary that is copy/move constructed from `a`, with the type having bee=
n deduced from the type of `a` (minus references of course). You want a sho=
rthand for:<br><br><div style=3D"border:1px solid rgb(187,187,187);backgrou=
nd-color:rgb(250,250,250)"><code><div><span style=3D"color:rgb(0,0,0)">std<=
/span><span style=3D"color:rgb(102,102,0)">::</span><span style=3D"color:rg=
b(0,0,0)">remove_reference_t</span><span style=3D"color:rgb(102,102,0)">&lt=
;</span><span style=3D"color:rgb(0,0,136)">declty<wbr>pe</span><span style=
=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">a</span>=
<span style=3D"color:rgb(102,102,0)">)&gt;(</span><span style=3D"color:rgb(=
0,0,0)">a</span><span style=3D"color:rgb(102,102,0)">)</span></div></code><=
/div><br>Your basic problem in this case is that fact that the destination =
function was taking and returning references to the parameters, and you wer=
e trying to store those values in the variables being referenced. Your solu=
tion is to create a pair of temporaries, pass them, and copy the temporarie=
s back into your variables.<br><br>Or... you could just create variables. Y=
ou could even use `auto newA =3D a` to create it. And you can use scoping t=
o make them temporary:<br><br><div style=3D"border:1px solid rgb(187,187,18=
7);background-color:rgb(250,250,250)"><code><div><span style=3D"color:rgb(1=
02,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 </span><span=
 style=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)"> =
oldA </span><span style=3D"color:rgb(102,102,0)">=3D</span><span style=3D"c=
olor:rgb(0,0,0)"> a</span><span style=3D"color:rgb(102,102,0)">,</span><spa=
n style=3D"color:rgb(0,0,0)"> oldB </span><span style=3D"color:rgb(102,102,=
0)">=3D</span><span style=3D"color:rgb(0,0,0)"> b</span><span style=3D"colo=
r:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 std</=
span><span style=3D"color:rgb(102,102,0)">::</span><span style=3D"color:rgb=
(0,0,0)">tie</span><span style=3D"color:rgb(102,102,0)">(</span><span style=
=3D"color:rgb(0,0,0)"> a</span><span style=3D"color:rgb(102,102,0)">,</span=
><span style=3D"color:rgb(0,0,0)"> b </span><span style=3D"color:rgb(102,10=
2,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color=
:rgb(102,102,0)">=3D</span><span style=3D"color:rgb(0,0,0)"> std</span><spa=
n style=3D"color:rgb(102,102,0)">::</span><span style=3D"color:rgb(0,0,0)">=
minmax</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"co=
lor:rgb(0,0,0)"> oldA</span><span style=3D"color:rgb(102,102,0)">,</span><s=
pan style=3D"color:rgb(0,0,0)"> oldB </span><span style=3D"color:rgb(102,10=
2,0)">);</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"c=
olor:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span></=
div></code></div><br>Is this something we really need to modify the languag=
e to do? Is it common enough that we need specialized syntax to solve it?<b=
r><br>Do you have any other use cases for such functionality?<br></div></di=
v></blockquote><div><br></div><div><br></div><div>I showed I bad example.=
=C2=A0I wanted to demonstrate just the idea.</div><div><br></div><div>Here =
is=C2=A0a correct example </div><div><br></div><div>=C2=A0=C2=A0=C2=A0 std:=
:vector&lt;int&gt; v =3D { 1, 2, 3, 7, 1, 5, 4 };=C2=A0<br>=C2=A0=C2=A0<br>=
=C2=A0=C2=A0=C2=A0 v.erase( std::remove( v.begin(), v.end(), auto( v[0] )=
=C2=A0), v.end() );=C2=A0=C2=A0</div></blockquote><div><br></div><div><br><=
/div><div>That is the idea is to do the conversion on the fly without using=
 compound expressions.=C2=A0</div></blockquote></div></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1_1734711264.1444090377389--
------=_Part_0_2130957191.1444090377381--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 5 Oct 2015 18:24:58 -0700 (PDT)
Raw View
------=_Part_4252_1170265457.1444094698717
Content-Type: multipart/alternative;
 boundary="----=_Part_4253_826242280.1444094698717"

------=_Part_4253_826242280.1444094698717
Content-Type: text/plain; charset=UTF-8

On Monday, October 5, 2015 at 8:12:59 PM UTC-4, T. C. wrote:
>
> http://cplusplus.github.io/EWG/ewg-active.html#188
>
> Although LWG might get to it first with decay_copy.
>

So long as the suggested `decay_copy` function works, I see no reason to
make it a language feature. Presumably, it would be implemented like this:

template<typename T> auto decay_copy(const T &t) {return t;}




--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr">On Monday, October 5, 2015 at 8:12:59 PM UTC-4, T. C. wrot=
e:<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"><a href=3D"=
http://cplusplus.github.io/EWG/ewg-active.html#188" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\7=
5http%3A%2F%2Fcplusplus.github.io%2FEWG%2Fewg-active.html%23188\46sa\75D\46=
sntz\0751\46usg\75AFQjCNF7D0ydgRFRd6s3ixjJ19MpxvdUSA&#39;;return true;" onc=
lick=3D"this.href=3D&#39;http://www.google.com/url?q\75http%3A%2F%2Fcpluspl=
us.github.io%2FEWG%2Fewg-active.html%23188\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNF7D0ydgRFRd6s3ixjJ19MpxvdUSA&#39;;return true;">http://cplusplus.github.=
io/<wbr>EWG/ewg-active.html#188</a><div><br></div><div>Although LWG might g=
et to it first with decay_copy.</div></div></blockquote><div><br>So long as=
 the suggested `decay_copy` function works, I see no reason to make it a la=
nguage feature. Presumably, it would be implemented like this:<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-wr=
ap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">template</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> decay_copy</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> T </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">t</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: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> t</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;}</span></div></code></div><br><br><br><br></div></di=
v>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4253_826242280.1444094698717--
------=_Part_4252_1170265457.1444094698717--

.


Author: =?UTF-8?Q?Agust=c3=adn_K-ballo_Berg=c3=a9?= <kaballo86@hotmail.com>
Date: Mon, 5 Oct 2015 22:37:48 -0300
Raw View
On 10/5/2015 10:24 PM, Nicol Bolas wrote:
> On Monday, October 5, 2015 at 8:12:59 PM UTC-4, T. C. wrote:
>
>     http://cplusplus.github.io/EWG/ewg-active.html#188
>     <http://cplusplus.github.io/EWG/ewg-active.html#188>
>
>     Although LWG might get to it first with decay_copy.
>
>
> So long as the suggested `decay_copy` function works, I see no reason to
> make it a language feature. Presumably, it would be implemented like this=
:
>
> |
> template<typenameT>autodecay_copy(constT &t){returnt;}
> |

This would do wasteful copies from rvalues. If you look at 30.2.6=20
[thread.decaycopy] you'll see it's defined as:

     template <class T> decay_t<T> decay_copy(T&& v)
       { return std::forward<T>(v); }

I guess `auto` would do too.

Regards,
--=20
Agust=C3=ADn K-ballo Berg=C3=A9.-
http://talesofcpp.fusionfenix.com

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: David Krauss <potswa@gmail.com>
Date: Tue, 6 Oct 2015 15:34:54 +0800
Raw View
--Apple-Mail=_D01DCD90-2953-4100-9334-C1E4B27ABB33
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9310=E2=80=9306, at 9:37 AM, Agust=C3=ADn K-ballo Berg=C3=
=A9 <kaballo86@hotmail.com> wrote:
>=20
> This would do wasteful copies from rvalues. If you look at 30.2.6 [thread=
..decaycopy] you'll see it's defined as:
>=20
>    template <class T> decay_t<T> decay_copy(T&& v)
>      { return std::forward<T>(v); }
>=20
> I guess `auto` would do too.


decay_copy would always perform a copy, from an lvalue, xvalue, or prvalue.

auto{} would allow copy elision for prvalue operands. It would copy lvalue,=
 xvalue, and derived-type prvalues.

The ideal solution would return only lvalues by value, and rvalues always b=
y reference. An overloaded function can do this, but the references would t=
end to dangle without lifetime extension of function operands a la P0066 <h=
ttp://wg21.link/P0066>. However, that still doesn=E2=80=99t (yet) cover ass=
ignment operations like to std::tie in the OP.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_D01DCD90-2953-4100-9334-C1E4B27ABB33
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9310=
=E2=80=9306, at 9:37 AM, Agust=C3=ADn K-ballo Berg=C3=A9 &lt;<a href=3D"mai=
lto:kaballo86@hotmail.com" class=3D"">kaballo86@hotmail.com</a>&gt; wrote:<=
/div><br class=3D"Apple-interchange-newline"><div class=3D""><span style=3D=
"font-family: Helvetica; font-size: 12px; font-style: normal; font-variant:=
 normal; font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: none; w=
hite-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-wi=
dth: 0px; float: none; display: inline !important;" class=3D"">This would d=
o wasteful copies from rvalues. If you look at 30.2.6 [thread.decaycopy] yo=
u'll see it's defined as:</span><br style=3D"font-family: Helvetica; font-s=
ize: 12px; font-style: normal; font-variant: normal; font-weight: normal; l=
etter-spacing: normal; line-height: normal; orphans: auto; text-align: star=
t; text-indent: 0px; text-transform: none; white-space: normal; widows: aut=
o; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""><br style=
=3D"font-family: Helvetica; font-size: 12px; font-style: normal; font-varia=
nt: normal; font-weight: normal; letter-spacing: normal; line-height: norma=
l; orphans: auto; text-align: start; text-indent: 0px; text-transform: none=
; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke=
-width: 0px;" class=3D""><span style=3D"font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant: normal; font-weight: normal; letter=
-spacing: normal; line-height: normal; orphans: auto; text-align: start; te=
xt-indent: 0px; text-transform: none; white-space: normal; widows: auto; wo=
rd-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inli=
ne !important;" class=3D"">&nbsp;&nbsp;&nbsp;template &lt;class T&gt; decay=
_t&lt;T&gt; decay_copy(T&amp;&amp; v)</span><br style=3D"font-family: Helve=
tica; font-size: 12px; font-style: normal; font-variant: normal; font-weigh=
t: normal; letter-spacing: normal; line-height: normal; orphans: auto; text=
-align: start; text-indent: 0px; text-transform: none; white-space: normal;=
 widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D=
""><span style=3D"font-family: Helvetica; font-size: 12px; font-style: norm=
al; font-variant: normal; font-weight: normal; letter-spacing: normal; line=
-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-t=
ransform: none; white-space: normal; widows: auto; word-spacing: 0px; -webk=
it-text-stroke-width: 0px; float: none; display: inline !important;" class=
=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ return std::forward&lt;T&gt;(v); }</s=
pan><br style=3D"font-family: Helvetica; font-size: 12px; font-style: norma=
l; font-variant: normal; font-weight: normal; letter-spacing: normal; line-=
height: normal; orphans: auto; text-align: start; text-indent: 0px; text-tr=
ansform: none; white-space: normal; widows: auto; word-spacing: 0px; -webki=
t-text-stroke-width: 0px;" class=3D""><br style=3D"font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: nor=
mal; letter-spacing: normal; line-height: normal; orphans: auto; text-align=
: start; text-indent: 0px; text-transform: none; white-space: normal; widow=
s: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""><sp=
an style=3D"font-family: Helvetica; font-size: 12px; font-style: normal; fo=
nt-variant: normal; font-weight: normal; letter-spacing: normal; line-heigh=
t: normal; orphans: auto; text-align: start; text-indent: 0px; text-transfo=
rm: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-tex=
t-stroke-width: 0px; float: none; display: inline !important;" class=3D"">I=
 guess `auto` would do too.</span><br style=3D"font-family: Helvetica; font=
-size: 12px; font-style: normal; font-variant: normal; font-weight: normal;=
 letter-spacing: normal; line-height: normal; orphans: auto; text-align: st=
art; text-indent: 0px; text-transform: none; white-space: normal; widows: a=
uto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""></div><=
/blockquote></div><div class=3D""><br class=3D""></div><div class=3D""><fon=
t face=3D"Courier" class=3D"">decay_copy</font> would always perform a copy=
, from an lvalue, xvalue, or prvalue.</div><div class=3D""><font face=3D"Co=
urier" class=3D""><br class=3D""></font></div><div class=3D""><font face=3D=
"Courier" class=3D"">auto{}</font> would allow copy elision for prvalue ope=
rands. It would copy lvalue, xvalue, and derived-type prvalues.</div><div c=
lass=3D""><br class=3D""></div><div class=3D"">The ideal solution would ret=
urn only lvalues by value, and rvalues always by reference. An overloaded f=
unction can do this, but the references would tend to dangle without lifeti=
me extension of function operands a la&nbsp;<a href=3D"http://wg21.link/P00=
66" class=3D"">P0066</a>. However, that still doesn=E2=80=99t (yet) cover a=
ssignment operations like to&nbsp;<font face=3D"Courier" class=3D"">std::ti=
e</font> in the OP.</div><div class=3D""><br class=3D""></div></body></html=
>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_D01DCD90-2953-4100-9334-C1E4B27ABB33--

.


Author: David Krauss <potswa@gmail.com>
Date: Tue, 6 Oct 2015 15:37:43 +0800
Raw View
--Apple-Mail=_02AA9DDA-4D07-484A-8EA0-5FB7647A9054
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9310=E2=80=9306, at 3:34 PM, David Krauss <potswa@gmail.com=
> wrote:
>=20
> auto{} would allow copy elision for prvalue operands. It would copy lvalu=
e, xvalue, and derived-type prvalues.

Brain fart. If it=E2=80=99s spelled auto it can=E2=80=99t be a derived type=
..

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_02AA9DDA-4D07-484A-8EA0-5FB7647A9054
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9310=
=E2=80=9306, at 3:34 PM, David Krauss &lt;<a href=3D"mailto:potswa@gmail.co=
m" class=3D"">potswa@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-inter=
change-newline"><div class=3D""><div class=3D"" style=3D"font-family: Helve=
tica; font-size: 12px; font-style: normal; font-variant: normal; font-weigh=
t: normal; letter-spacing: normal; line-height: normal; orphans: auto; text=
-align: start; text-indent: 0px; text-transform: none; white-space: normal;=
 widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font fa=
ce=3D"Courier" class=3D"">auto{}</font><span class=3D"Apple-converted-space=
">&nbsp;</span>would allow copy elision for prvalue operands. It would copy=
 lvalue, xvalue, and derived-type prvalues.</div></div></blockquote></div><=
br class=3D""><div class=3D"">Brain fart. If it=E2=80=99s spelled <font fac=
e=3D"Courier" class=3D"">auto</font> it can=E2=80=99t be a derived type.</d=
iv></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_02AA9DDA-4D07-484A-8EA0-5FB7647A9054--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Tue, 6 Oct 2015 03:56:04 -0700 (PDT)
Raw View
------=_Part_380_1729232834.1444128964460
Content-Type: multipart/alternative;
 boundary="----=_Part_381_1227441326.1444128964470"

------=_Part_381_1227441326.1444128964470
Content-Type: text/plain; charset=UTF-8


On Monday, October 5, 2015 at 11:24:39 PM UTC+3, Vlad from Moscow wrote:
>
> One of methods to convert lvalue to rvalue is to use the functional of
> explicit conversion.
>
> Compare these two examples
>
> //...
>
> int main()
> {
> {
>     int a = 10;
>     int b = 5;
>
>     std::tie( a, b ) = std::minmax( a, b );
>     std::cout << "a = " << a << ", b = " << b << std::endl;
> }
> {
>     int a = 10;
>     int b = 5;
>
>     std::tie( a, b ) = std::minmax( int { a }, int { b } );
>     std::cout << "a = " << a << ", b = " << b << std::endl;
> }
> }
>
> The out put correspondingly is
>
> a = 5, b = 5
> a = 5, b = 10
>
> I am suggesting to use the following general syntax
>
>     std::tie( a, b ) = std::minmax( auto( a ), auto( b ) );
>
>
A simplified example that demonstrates the idea

#include <iostream>

void f( int &&x ) { std::cout << "f( int &&( " << x << " ) )\n"; }
void f( int &x ) { std::cout << "f( int &( " << x << " ) )\n"; }

int main()
{
    int x = 3;

    f( x );
    f( 3 );
}

So in the code above I want to substitute the call f( 3 ) for

f( auto( x ) );



--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<br>On Monday, October 5, 2015 at 11:24:39 PM UTC+3, Vlad from Moscow wrote=
:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padd=
ing-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1p=
x; border-left-style: solid;"><div dir=3D"ltr"><div>One of methods to conve=
rt=C2=A0lvalue to rvalue is to use the functional of explicit conversion.</=
div><div><br></div><div>Compare these two examples</div><div><br></div><div=
>//...</div><div><br></div><div>int main()<br>{<br>{<br>=C2=A0=C2=A0=C2=A0 =
int a =3D 10;<br>=C2=A0=C2=A0=C2=A0 int b =3D 5;<br>=C2=A0=C2=A0=C2=A0 <br>=
=C2=A0=C2=A0=C2=A0 std::tie( a, b ) =3D std::minmax( a, b );<br>=C2=A0=C2=
=A0=C2=A0 std::cout &lt;&lt; &quot;a =3D &quot; &lt;&lt; a &lt;&lt; &quot;,=
 b =3D &quot; &lt;&lt; b &lt;&lt; std::endl;<br>}<br>{<br>=C2=A0=C2=A0=C2=
=A0 int a =3D 10;<br>=C2=A0=C2=A0=C2=A0 int b =3D 5;<br>=C2=A0=C2=A0=C2=A0 =
<br>=C2=A0=C2=A0=C2=A0 std::tie( a, b ) =3D std::minmax( int { a }, int { b=
 } );<br>=C2=A0=C2=A0=C2=A0 std::cout &lt;&lt; &quot;a =3D &quot; &lt;&lt; =
a &lt;&lt; &quot;, b =3D &quot; &lt;&lt; b &lt;&lt; std::endl;<br>}<br>}</d=
iv><div><br></div><div>The out=C2=A0put correspondingly is</div><div><br></=
div><div>a =3D 5, b =3D 5<br>a =3D 5, b =3D 10</div><div><br></div><div>I a=
m suggesting to use the following general syntax</div><div><br></div><div>=
=C2=A0=C2=A0=C2=A0 std::tie( a, b ) =3D std::minmax(=C2=A0auto( a ),=C2=A0a=
uto( b=C2=A0) );<br><br></div></div></blockquote><div><br></div><div>A simp=
lified example that demonstrates the idea</div><div><br></div><div>#include=
 &lt;iostream&gt;</div><div><br></div><div>void f( int &amp;&amp;x ) { std:=
:cout &lt;&lt; &quot;f( int &amp;&amp;( &quot; &lt;&lt; x &lt;&lt; &quot; )=
 )\n&quot;; }<br>void f(=C2=A0int &amp;x ) { std::cout &lt;&lt; &quot;f(=C2=
=A0int &amp;( &quot; &lt;&lt; x &lt;&lt; &quot; ) )\n&quot;; }</div><div><b=
r></div><div>int main()<br>{<br>=C2=A0=C2=A0=C2=A0 int x =3D 3;<br></div><d=
iv><br></div><div>=C2=A0=C2=A0=C2=A0 f( x );<br>=C2=A0=C2=A0=C2=A0 f( 3 );<=
br>}=C2=A0=C2=A0=C2=A0 <br></div><div><br></div><div>So in the code above I=
 want to substitute the call f( 3 ) for</div><div><br></div><div>f( auto( x=
 ) );</div><div><br></div><div>=C2=A0</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_381_1227441326.1444128964470--
------=_Part_380_1729232834.1444128964460--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Tue, 6 Oct 2015 04:06:49 -0700 (PDT)
Raw View
------=_Part_35_119634074.1444129609270
Content-Type: multipart/alternative;
 boundary="----=_Part_36_1099146795.1444129609270"

------=_Part_36_1099146795.1444129609270
Content-Type: text/plain; charset=UTF-8



On Tuesday, October 6, 2015 at 1:56:04 PM UTC+3, Vlad from Moscow wrote:
>
>
> On Monday, October 5, 2015 at 11:24:39 PM UTC+3, Vlad from Moscow wrote:
>>
>> One of methods to convert lvalue to rvalue is to use the functional of
>> explicit conversion.
>>
>> Compare these two examples
>>
>> //...
>>
>> int main()
>> {
>> {
>>     int a = 10;
>>     int b = 5;
>>
>>     std::tie( a, b ) = std::minmax( a, b );
>>     std::cout << "a = " << a << ", b = " << b << std::endl;
>> }
>> {
>>     int a = 10;
>>     int b = 5;
>>
>>     std::tie( a, b ) = std::minmax( int { a }, int { b } );
>>     std::cout << "a = " << a << ", b = " << b << std::endl;
>> }
>> }
>>
>> The out put correspondingly is
>>
>> a = 5, b = 5
>> a = 5, b = 10
>>
>> I am suggesting to use the following general syntax
>>
>>     std::tie( a, b ) = std::minmax( auto( a ), auto( b ) );
>>
>>
> A simplified example that demonstrates the idea
>
> #include <iostream>
>
> void f( int &&x ) { std::cout << "f( int &&( " << x << " ) )\n"; }
> void f( int &x ) { std::cout << "f( int &( " << x << " ) )\n"; }
>
> int main()
> {
>     int x = 3;
>
>     f( x );
>     f( 3 );
> }
>
> So in the code above I want to substitute the call f( 3 ) for
>
> f( auto( x ) );
>
>
>

I think that in the preceding example l

f( auto( 3 ) );

auto( 3 ) should not have any effect.

Or more interesting example

#include <iostream>

void f( int &&x ) { std::cout << "f( int &&( " << x << " ) )\n"; }
void f( int &x ) { std::cout << "f( int &( " << x << " ) )\n"; }

int main()
{
    int x = 3;
    int y = 5;

    f( x < y ? x : y );
    f( auto( x < y ? x : y ) );
}




--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<br><br>On Tuesday, October 6, 2015 at 1:56:04 PM UTC+3, Vlad from Moscow w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; =
padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width=
: 1px; border-left-style: solid;"><br>On Monday, October 5, 2015 at 11:24:3=
9 PM UTC+3, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(20=
4, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=
=3D"ltr"><div>One of methods to convert=C2=A0lvalue to rvalue is to use the=
 functional of explicit conversion.</div><div><br></div><div>Compare these =
two examples</div><div><br></div><div>//...</div><div><br></div><div>int ma=
in()<br>{<br>{<br>=C2=A0=C2=A0=C2=A0 int a =3D 10;<br>=C2=A0=C2=A0=C2=A0 in=
t b =3D 5;<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 std::tie( a, b ) =
=3D std::minmax( a, b );<br>=C2=A0=C2=A0=C2=A0 std::cout &lt;&lt; &quot;a =
=3D &quot; &lt;&lt; a &lt;&lt; &quot;, b =3D &quot; &lt;&lt; b &lt;&lt; std=
::endl;<br>}<br>{<br>=C2=A0=C2=A0=C2=A0 int a =3D 10;<br>=C2=A0=C2=A0=C2=A0=
 int b =3D 5;<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 std::tie( a, b )=
 =3D std::minmax( int { a }, int { b } );<br>=C2=A0=C2=A0=C2=A0 std::cout &=
lt;&lt; &quot;a =3D &quot; &lt;&lt; a &lt;&lt; &quot;, b =3D &quot; &lt;&lt=
; b &lt;&lt; std::endl;<br>}<br>}</div><div><br></div><div>The out=C2=A0put=
 correspondingly is</div><div><br></div><div>a =3D 5, b =3D 5<br>a =3D 5, b=
 =3D 10</div><div><br></div><div>I am suggesting to use the following gener=
al syntax</div><div><br></div><div>=C2=A0=C2=A0=C2=A0 std::tie( a, b ) =3D =
std::minmax(=C2=A0auto( a ),=C2=A0auto( b=C2=A0) );<br><br></div></div></bl=
ockquote><div><br></div><div>A simplified example that demonstrates the ide=
a</div><div><br></div><div>#include &lt;iostream&gt;</div><div><br></div><d=
iv>void f( int &amp;&amp;x ) { std::cout &lt;&lt; &quot;f( int &amp;&amp;( =
&quot; &lt;&lt; x &lt;&lt; &quot; ) )\n&quot;; }<br>void f(=C2=A0int &amp;x=
 ) { std::cout &lt;&lt; &quot;f(=C2=A0int &amp;( &quot; &lt;&lt; x &lt;&lt;=
 &quot; ) )\n&quot;; }</div><div><br></div><div>int main()<br>{<br>=C2=A0=
=C2=A0=C2=A0 int x =3D 3;<br></div><div><br></div><div>=C2=A0=C2=A0=C2=A0 f=
( x );<br>=C2=A0=C2=A0=C2=A0 f( 3 );<br>}=C2=A0=C2=A0=C2=A0 <br></div><div>=
<br></div><div>So in the code above I want to substitute the call f( 3 ) fo=
r</div><div><br></div><div>f( auto( x ) );</div><div><br></div><div>=C2=A0<=
/div></blockquote><div><br></div><div>I think that in the preceding example=
=C2=A0l=C2=A0</div><div><br></div><div>f( auto( 3 ) );</div><div><br></div>=
<div>auto( 3 ) should not have any effect.</div><div><br></div><div>Or more=
 interesting example</div><div><br></div><div>#include &lt;iostream&gt;</di=
v><div><br></div><div>void f( int &amp;&amp;x ) { std::cout &lt;&lt; &quot;=
f( int &amp;&amp;( &quot; &lt;&lt; x &lt;&lt; &quot; ) )\n&quot;; }<br>void=
 f( int &amp;x ) { std::cout &lt;&lt; &quot;f( int &amp;( &quot; &lt;&lt; x=
 &lt;&lt; &quot; ) )\n&quot;; }</div><div><br></div><div>int main()<br>{<br=
>=C2=A0=C2=A0=C2=A0 int x =3D 3;<br>=C2=A0=C2=A0=C2=A0 int y =3D 5;<br>=C2=
=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 f( x &lt; y ? x : y );<br>=C2=A0=C2=
=A0=C2=A0 f( auto( x &lt; y ? x : y ) );<br>}=C2=A0=C2=A0</div><div><br></d=
iv><div>=C2=A0=C2=A0<br>=C2=A0</div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_36_1099146795.1444129609270--
------=_Part_35_119634074.1444129609270--

.


Author: =?UTF-8?Q?Agust=c3=adn_K-ballo_Berg=c3=a9?= <kaballo86@hotmail.com>
Date: Tue, 6 Oct 2015 09:51:58 -0300
Raw View
On 10/6/2015 4:34 AM, David Krauss wrote:
>
>> On 2015=E2=80=9310=E2=80=9306, at 9:37 AM, Agust=C3=ADn K-ballo Berg=C3=
=A9
>> <kaballo86@hotmail.com <mailto:kaballo86@hotmail.com>> wrote:
>>
>> This would do wasteful copies from rvalues. If you look at 30.2.6
>> [thread.decaycopy] you'll see it's defined as:
>>
>>    template <class T> decay_t<T> decay_copy(T&& v)
>>      { return std::forward<T>(v); }
>>
>> I guess `auto` would do too.
>
> decay_copy would always perform a copy, from an lvalue, xvalue, or prvalu=
e.
>
> auto{} would allow copy elision for prvalue operands. It would copy
> lvalue, xvalue, and derived-type prvalues.

I don't know where this comes from. Since it says `auto` I'll assume is=20
about it being an option too. I meant this:

     template <class T> auto decay_copy(T&& v)
       { return std::forward<T>(v); }

Regards,
--=20
Agust=C3=ADn K-ballo Berg=C3=A9.-
http://talesofcpp.fusionfenix.com

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: David Krauss <potswa@gmail.com>
Date: Tue, 6 Oct 2015 21:10:06 +0800
Raw View
> On 2015=E2=80=9310=E2=80=9306, at 8:51 PM, Agust=C3=ADn K-ballo Berg=C3=
=A9 <kaballo86@hotmail.com> wrote:
>=20
> I don't know where this comes from. Since it says `auto` I'll assume is a=
bout it being an option too. I meant this:

From the OP. I just used braces instead of parens.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: =?UTF-8?Q?Agust=c3=adn_K-ballo_Berg=c3=a9?= <kaballo86@hotmail.com>
Date: Tue, 6 Oct 2015 10:18:07 -0300
Raw View
On 10/6/2015 10:10 AM, David Krauss wrote:
>
>> On 2015=E2=80=9310=E2=80=9306, at 8:51 PM, Agust=C3=ADn K-ballo Berg=C3=
=A9 <kaballo86@hotmail.com> wrote:
>>
>> I don't know where this comes from. Since it says `auto` I'll assume is =
about it being an option too. I meant this:
>
> From the OP. I just used braces instead of parens.

What I meant was your email is surprising, it does not seem to be=20
answering to anything I have said. I wonder if I am just missing it.

Regards,
--=20
Agust=C3=ADn K-ballo Berg=C3=A9.-
http://talesofcpp.fusionfenix.com

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: David Krauss <potswa@gmail.com>
Date: Tue, 6 Oct 2015 21:35:23 +0800
Raw View
--Apple-Mail=_5C25EF5D-C51C-4E22-823C-8984A5861BEE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9310=E2=80=9306, at 9:18 PM, Agust=C3=ADn K-ballo Berg=C3=
=A9 <kaballo86@hotmail.com> wrote:
>=20
> What I meant was your email is surprising, it does not seem to be answeri=
ng to anything I have said. I wonder if I am just missing it.

You mentioned that decay_copy creates unnecessary copies (3/3 value categor=
ies). My point is that auto{} creates slightly fewer (2/3), and my proposal=
 enables a solution which is ideal (1/3, only lvalues are copied).

Also I mentioned a problem between my proposal and the tie() example, but t=
hat=E2=80=99s fine, no problem =E2=80=94 no reference to a temporary is ret=
ained. I=E2=80=99ve got a little flu today and the synapses aren=E2=80=99t =
firing so well.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_5C25EF5D-C51C-4E22-823C-8984A5861BEE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9310=
=E2=80=9306, at 9:18 PM, Agust=C3=ADn K-ballo Berg=C3=A9 &lt;<a href=3D"mai=
lto:kaballo86@hotmail.com" class=3D"">kaballo86@hotmail.com</a>&gt; wrote:<=
/div><br class=3D"Apple-interchange-newline"><div class=3D""><span style=3D=
"font-family: Helvetica; font-size: 12px; font-style: normal; font-variant:=
 normal; font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: none; w=
hite-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-wi=
dth: 0px; float: none; display: inline !important;" class=3D"">What I meant=
 was your email is surprising, it does not seem to be answering to anything=
 I have said. I wonder if I am just missing it.</span><br style=3D"font-fam=
ily: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: =
auto; text-align: start; text-indent: 0px; text-transform: none; white-spac=
e: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;=
" class=3D""></div></blockquote></div><br class=3D""><div class=3D"">You me=
ntioned that <font face=3D"Courier" class=3D"">decay_copy</font> creates un=
necessary copies (3/3 value categories). My point is that <font face=3D"Cou=
rier" class=3D"">auto{}</font> creates slightly fewer (2/3), and my proposa=
l enables a solution which is ideal (1/3, only lvalues are copied).</div><d=
iv class=3D""><br class=3D""></div><div class=3D"">Also I mentioned a probl=
em between my proposal and the&nbsp;<font face=3D"Courier" class=3D"">tie()=
</font> example, but that=E2=80=99s fine, no problem =E2=80=94 no reference=
 to a temporary is retained. I=E2=80=99ve got a little flu today and the sy=
napses aren=E2=80=99t firing so well.</div><div class=3D""><br class=3D""><=
/div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_5C25EF5D-C51C-4E22-823C-8984A5861BEE--

.


Author: =?UTF-8?Q?Agust=c3=adn_K-ballo_Berg=c3=a9?= <kaballo86@hotmail.com>
Date: Tue, 6 Oct 2015 10:54:42 -0300
Raw View
On 10/6/2015 10:35 AM, David Krauss wrote:
>
>> On 2015=E2=80=9310=E2=80=9306, at 9:18 PM, Agust=C3=ADn K-ballo Berg=C3=
=A9
>> <kaballo86@hotmail.com <mailto:kaballo86@hotmail.com>> wrote:
>>
>> What I meant was your email is surprising, it does not seem to be
>> answering to anything I have said. I wonder if I am just missing it.
>
> You mentioned that decay_copy creates unnecessary copies (3/3 value
> categories). My point is that auto{} creates slightly fewer (2/3), and
> my proposal enables a solution which is ideal (1/3, only lvalues are
> copied).

I see. I did miss that connection on my initial reading.

Regards,
--=20
Agust=C3=ADn K-ballo Berg=C3=A9.-
http://talesofcpp.fusionfenix.com

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.