220 21313 <f8a1e157-ae9a-40f8-9bc1-5aff59eefc10@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: Conversion from lvalue to rvalue
Date: Mon, 5 Oct 2015 13:24:38 -0700 (PDT)
Lines: 90
Approved: news@gmane.org
Message-ID: <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_579_437436720.1444076678851"
X-Trace: ger.gmane.org 1444076683 354 80.91.229.3 (5 Oct 2015 20:24:43 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 5 Oct 2015 20:24:43 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCXLLRHD7IDRBCFZZOYAKGQEFVMFR2A@isocpp.org Mon Oct 05 22:24:42 2015
Return-path: <std-proposals+bncBCXLLRHD7IDRBCFZZOYAKGQEFVMFR2A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f72.google.com ([209.85.218.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRBCFZZOYAKGQEFVMFR2A@isocpp.org>)
	id 1ZjCJN-0003BD-L4
	for gclcip-std-proposals@m.gmane.org; Mon, 05 Oct 2015 22:24:41 +0200
Original-Received: by oibi136 with SMTP id i136sf294297792oib.3
        for <gclcip-std-proposals@m.gmane.org>; Mon, 05 Oct 2015 13:24:40 -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: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=4TaArQ1J/mN3tvki/ZeJScW4gczU+RXuoaE5GAkjId8=;
        b=iGV6ZNQ8ONBh+q8cMo8MYUA+MtiPldXkKq5x6gYbmEhE//7sZIwTewxKiLqOZZxs3T
         UwVKjUVkewnZTDfc8cwEoyXXqkeblKIYInk2YTdeVAlGC6PesvcYHn/NIgoAdUQSyfvm
         p04Sd5+vOpr7t3+S20CACYnWmhg6Uq0oq7cdRPBUhn7PAlL0tbV9sJFdPP2Ytz8Epy0l
         p3XGiCnjaPmNizApN//X2WVxjT8uHBWXZa9sNkThyGeNgGbkNDl3Ivey3vnFhYV4ROZL
         V6eARd3HqaShLuZyIw1UpPQJwBEW7ILa2+cA523ib9Z1Ll32Zuj9dTB66AWbCZoSgc76
         mlIw==
X-Gm-Message-State: ALoCoQnjwGOjGyZhHylP7gN+TYyiP4wrqEWHeQWPJML/n//ISuck7NODIcmasHeAOgjAj+ChkpzN
X-Received: by 10.182.24.9 with SMTP id q9mr29198866obf.13.1444076680847;
        Mon, 05 Oct 2015 13:24:40 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.111.79 with SMTP id ig15ls1312440igb.10.gmail; Mon, 05 Oct
 2015 13:24:39 -0700 (PDT)
X-Received: by 10.50.131.164 with SMTP id on4mr154991igb.8.1444076679886;
        Mon, 05 Oct 2015 13:24:39 -0700 (PDT)
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:21313
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/21313>

------=_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--

.
