220 5232 <ef2f2686-f898-41c2-abc7-c6687c816f67@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Jonathan Wakely <cxx@kayari.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Teachability problems with std::move
Date: Wed, 26 Jun 2013 05:08:41 -0700 (PDT)
Lines: 109
Approved: news@gmane.org
Message-ID: <ef2f2686-f898-41c2-abc7-c6687c816f67@isocpp.org>
References: <CA+cyFgsYFbjG1M98PJS-XVzuJYbQmt7=4GOqS5_V5-WVJ0caLg@mail.gmail.com>
 <aa993593-2e71-4c1e-a510-d678672e5c17@isocpp.org>
 <73cad38f-c1b6-4ce3-bfc1-e4a660dbb638@isocpp.org>
 <CAFk2RUbJ1AqZ==1zsCQjtVm-YRuLhRjtXzyV=kPvX1FH8q9z6g@mail.gmail.com>
 <09ec0612-ac10-48fb-a186-bd3c200bd5fe@isocpp.org>
 <20f56505-2fba-4041-9d81-26088e67dc5d@isocpp.org>
 <CAMeU-s1SWuGH0J-o=ojWEV5w3JTO6J=OgDe92mf9w8dV7+emtw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_451_27735288.1372248521655"
X-Trace: ger.gmane.org 1372248525 22664 80.91.229.3 (26 Jun 2013 12:08:45 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 26 Jun 2013 12:08:45 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCMONUNYS4IRBSVTVOHAKGQEGIJJN4Q@isocpp.org Wed Jun 26 14:08:44 2013
Return-path: <std-proposals+bncBCMONUNYS4IRBSVTVOHAKGQEGIJJN4Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oa0-f71.google.com ([209.85.219.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCMONUNYS4IRBSVTVOHAKGQEGIJJN4Q@isocpp.org>)
	id 1UroWi-0004v8-8l
	for gclcip-std-proposals@m.gmane.org; Wed, 26 Jun 2013 14:08:44 +0200
Original-Received: by mail-oa0-f71.google.com with SMTP id k14sf22106615oag.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 26 Jun 2013 05:08:43 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=x-beenthere:date:from:to:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=odmNBnQNLKqnojzM8IweNEqNaqp3VuPfIAogsskf08g=;
        b=dbGQmGgdPVu86HIgxtju59SANiBATMTE0/VWTqO9xfNql5larVaPCcPDYog4ZMXD0y
         VtiOmIHFZPthLy9IEsEyh7n34g2r/vdZEXSQQFE/G/A5As49n2WPFBo6Uz+JQF3W+1FL
         AXETEIt28qV+KcJK6mK5c9EloTCletZ0q+6nG9vOmz9iQPPeSriGyw8EI4S9CHFNRDUl
         Mb2cSDuVQHsRPt3qJwdrLR16w/xHFZJNcxNsgpmqBgZCzGuyFHIhPTHQ/Rczd82tGMig
         gudO+j1FXs+OUJxeX8tAxIJ+29Px/0lm83TuI5005Q1vX53eUDFuYm4mjTHQNRJdpNpt
         5rpg==
X-Received: by 10.182.230.169 with SMTP id sz9mr617840obc.48.1372248523217;
        Wed, 26 Jun 2013 05:08:43 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.233.131 with SMTP id tw3ls62810obc.70.gmail; Wed, 26 Jun
 2013 05:08:42 -0700 (PDT)
X-Received: by 10.182.114.228 with SMTP id jj4mr3108obb.8.1372248522152;
        Wed, 26 Jun 2013 05:08:42 -0700 (PDT)
In-Reply-To: <CAMeU-s1SWuGH0J-o=ojWEV5w3JTO6J=OgDe92mf9w8dV7+emtw@mail.gmail.com>
X-Original-Sender: cxx@kayari.org
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:5232
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5232>

------=_Part_451_27735288.1372248521655
Content-Type: text/plain; charset=ISO-8859-1



On Wednesday, June 26, 2013 12:10:58 PM UTC+1, Mikhail Semenov wrote:
>
> > Coming back to the original topic, are you really suggesting the code 
> above is the ideal form for teaching when to use std::move and when > not 
> to?  I think "return result;" is much simpler.
>   
> If you have to convert from std::unique_ptr<Foo> to std::unique_ptr<const 
> Foo>
> the following code *WON'T COMPILE*;
> *return result;*
>  
> *Try it in your compiler!*
>  
> My point is that if you have to convert  (from std::unique_ptr<Foo> to 
> std::unique_ptr<const Foo>) write it explicitly:
>  
>  *return std::unique_ptr<const Foo>(std::move(result));*
>  
> If you don't have to convert (you use the same unque_ptr types) than yes write 
> as you said:
> ** 
> *return result*.
>
>
Yep, I know, I was referring to Geoffrey's suggestion to change that rule 
in the first post in this thread: "It would be clear anyway with Geoffrey's 
suggestion".   Apologies for trying to discuss the thread topic ;)


-- 

--- 
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_451_27735288.1372248521655
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>On Wednesday, June 26, 2013 12:10:58 PM UTC+1, Mikhail Semenov 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><font style=3D"BACKGROU=
ND-COLOR:#ffffff" color=3D"#3333ff">&gt; Coming back to the original topic,=
 are you really suggesting the code above is the ideal form for teaching wh=
en to use std::move and when &gt; not to?&nbsp; I think "return result;" is=
 much simpler.<br>
</font></div>
<div><font style=3D"BACKGROUND-COLOR:#ffffff" color=3D"#3333ff"><font color=
=3D"#000000"></font></font>&nbsp;</div>
<div><font style=3D"BACKGROUND-COLOR:#ffffff" color=3D"#3333ff"><font color=
=3D"#000000">If you have to convert from std::unique_ptr&lt;Foo&gt; to std:=
:unique_ptr&lt;const Foo&gt;</font></font></div>
<div>the following code <font color=3D"#ff0000"><b>WON'T COMPILE</b></font>=
;</div>
<div><b>return result;</b></div>
<div>&nbsp;</div>
<div><font color=3D"#ff6666"><b>Try it in your compiler!</b></font></div>
<div><font style=3D"BACKGROUND-COLOR:#ffffff" color=3D"#3333ff"><font color=
=3D"#000000"></font></font>&nbsp;</div>
<div><font style=3D"BACKGROUND-COLOR:#ffffff" color=3D"#3333ff"><font color=
=3D"#000000">My point is that if you have to convert&nbsp; (from std::uniqu=
e_ptr&lt;Foo&gt; to std::unique_ptr&lt;const Foo&gt;) write it explicitly:<=
/font></font></div>

<div><font style=3D"BACKGROUND-COLOR:#ffffff" color=3D"#3333ff"><font color=
=3D"#000000"></font>&nbsp;</font></div>
<div>
<div><font style=3D"BACKGROUND-COLOR:#ffffff" color=3D"#3333ff"><font color=
=3D"#000000"><b>return std::unique_ptr&lt;const Foo&gt;(std::move(result));=
</b></font></font></div></div>
<div>&nbsp;</div>
<div><font color=3D"#000000">If you don't have to convert (you use the same=
 unque_ptr types) than yes </font><font color=3D"#000000">write as you said=
:</font></div>
<div><font color=3D"#000000"><b></b></font>&nbsp;</div>
<div><font color=3D"#000000"><b>return result</b>.</font></div>
<div><font color=3D"#000000"></font><br></div></blockquote><div><br>Yep, I =
know, I was referring to Geoffrey's suggestion to change that rule in the f=
irst post in this thread: "It would be clear anyway with Geoffrey's suggest=
ion".&nbsp;&nbsp; Apologies for trying to discuss the thread topic ;)<br><b=
r><br></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />
&nbsp;<br />
&nbsp;<br />

------=_Part_451_27735288.1372248521655--

.
