220 21342 <0a839ad1-1a3c-4323-a20c-3cd910ec08f4@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vlad from Moscow <vlad.moscow@mail.ru>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Conversion from lvalue to rvalue
Date: Tue, 6 Oct 2015 03:56:04 -0700 (PDT)
Lines: 128
Approved: news@gmane.org
Message-ID: <0a839ad1-1a3c-4323-a20c-3cd910ec08f4@isocpp.org>
References: <f8a1e157-ae9a-40f8-9bc1-5aff59eefc10@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_380_1729232834.1444128964460"
X-Trace: ger.gmane.org 1444128971 10863 80.91.229.3 (6 Oct 2015 10:56:11 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 6 Oct 2015 10:56:11 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCXLLRHD7IDRBRORZ2YAKGQE2PF6RGY@isocpp.org Tue Oct 06 12:56:10 2015
Return-path: <std-proposals+bncBCXLLRHD7IDRBRORZ2YAKGQE2PF6RGY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f198.google.com ([209.85.160.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRBRORZ2YAKGQE2PF6RGY@isocpp.org>)
	id 1ZjPuh-0000iC-C4
	for gclcip-std-proposals@m.gmane.org; Tue, 06 Oct 2015 12:56:07 +0200
Original-Received: by ykdg206 with SMTP id g206sf276003268ykd.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 06 Oct 2015 03:56:06 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=AddaPCLnX8jDToTJnO/Bi8aQGhlsJ3TE1AOgwK5VBNE=;
        b=KOE19nBhVzTWgKV1HrGwmIr8b62y9slQ2Ynpm+HzYK+tIcKbLkC1kHd/owHxPm5EtJ
         LZe8hpLiPfgmZ6XOMblJWn541Qa1SL3RhUaS5pWN/lvf6w+6P0oPjghQzz4eoy1JU+Ss
         PpYnGJjbrOfZZl06FqHLK/G886DyPRR5iaGSM6JUT1++Pu2i+PwC4uwOCke+wXqQpyk+
         EaeqaRgnjr3L+4BvOIQbvz3O3UBtpd11Y4J3jQC+ZS/WL0TT7CgmuQJ1A7dkbyd3aZvl
         g4Xi0dQ8XS1XreUzPUsP+P1ZZefxhR9Vfx7GlKR72TepSUa7dfkFk4L3uuaYXVAzeXLz
         +dDg==
X-Gm-Message-State: ALoCoQngk6wEG/MMx1MhLSbqBYolDVY3E6m+OCndiHEYR/59kAwHNVbCiGQiF7PGhruBh4JNcT3E
X-Received: by 10.140.237.202 with SMTP id i193mr30391396qhc.10.1444128966351;
        Tue, 06 Oct 2015 03:56:06 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.132.164 with SMTP id o36ls1873103ioi.64.gmail; Tue, 06 Oct
 2015 03:56:05 -0700 (PDT)
X-Received: by 10.50.114.36 with SMTP id jd4mr185767igb.6.1444128965417;
        Tue, 06 Oct 2015 03:56:05 -0700 (PDT)
In-Reply-To: <f8a1e157-ae9a-40f8-9bc1-5aff59eefc10@isocpp.org>
X-Original-Sender: vlad.moscow@mail.ru
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:21342
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/21342>

------=_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--

.
