220 2763 <fc66c7fe-c074-47f3-8fbf-ed4d685f53c4@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: =?UTF-8?Q?Andrzej_Krzemie=C5=84ski?= <akrzemi1@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: optional references -- take 2
Date: Wed, 6 Feb 2013 23:57:46 -0800 (PST)
Lines: 127
Approved: news@gmane.org
Message-ID: <fc66c7fe-c074-47f3-8fbf-ed4d685f53c4@isocpp.org>
References: <8d57e9e9-e4cc-441c-abeb-e6526531fad5@isocpp.org>
 <CAOHCbiuw0zezce9kcXVsEcE=mPmp=93zQHSRMzUcNw6u3TCsBQ@mail.gmail.com>
 <ca43f129-cd55-43d3-89fc-1e4402af0e9f@isocpp.org> <3534ECE0-D67E-443E-9593-76B644FDDF6A@gmail.com>
 <3aca8f41-7a21-40d8-9bf9-9c27dfa778f3@isocpp.org>
 <CAGg_6+PRK5Szu=51fPjx35aiC=MM07NYsZZnCS3c+0zdkv3qiQ@mail.gmail.com>
 <5095aadf-58c1-458b-bc9f-6bbd7499aa59@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_1105_16985628.1360223866535"
X-Trace: ger.gmane.org 1360223866 17028 80.91.229.3 (7 Feb 2013 07:57:46 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 7 Feb 2013 07:57:46 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDT2DGOJ34DBB654ZWEAKGQEY635NVA@isocpp.org Thu Feb 07 08:58:07 2013
Return-path: <std-proposals+bncBDT2DGOJ34DBB654ZWEAKGQEY635NVA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gh0-f198.google.com ([209.85.160.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDT2DGOJ34DBB654ZWEAKGQEY635NVA@isocpp.org>)
	id 1U3MMw-000898-Kg
	for gclcip-std-proposals@m.gmane.org; Thu, 07 Feb 2013 08:58:06 +0100
Original-Received: by mail-gh0-f198.google.com with SMTP id r11sf2983002ghr.9
        for <gclcip-std-proposals@m.gmane.org>; Wed, 06 Feb 2013 23:57:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received: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=ppP9ngmmiTdAH+67ODyk+Wu6XPVDEuz+G7KhSyBRy8s=;
        b=NV6CXzmB6Ww2glTYvjCkWz/wgFykIbWYykw+rxasAt6oOXFZzzRaEXmZ3skE/tHf7R
         T3uoQV1xjifPNw+mXuyHhIqu2CSKNj/cKEQgnNlRV/FzgTL12n0VBY6gqIN7hQ0F8Szr
         LBBrdjoA9HtL24W5lEBnPQx487bC91QBZzPEfVPOscNJxht/6EmCuBe7z9mHrZTLkkm3
         SwNvduz2ViYNGMJGbZkFoFKO18joCwsDz1ibw6XacQY5F//RXatssluR7Pl7GH4Mv1Z1
         Ba0KyRzG04Sqx6k8rAAZ+Qeajb1UKT4yuWZpF2DHFPPP2rDd+zAK7H3nsDkrW9dJhQ9Q
         y/eg==
X-Received: by 10.224.178.207 with SMTP id bn15mr658312qab.1.1360223867298;
        Wed, 06 Feb 2013 23:57:47 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.16.37 with SMTP id c5ls601862qed.80.gmail; Wed, 06 Feb 2013
 23:57:46 -0800 (PST)
X-Received: by 10.49.75.9 with SMTP id y9mr23177qev.9.1360223866921;
        Wed, 06 Feb 2013 23:57:46 -0800 (PST)
In-Reply-To: <5095aadf-58c1-458b-bc9f-6bbd7499aa59@isocpp.org>
X-Original-Sender: akrzemi1@gmail.com
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?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:2763
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2763>

------=_Part_1105_16985628.1360223866535
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable



W dniu czwartek, 7 lutego 2013 04:55:22 UTC+1 u=BFytkownik Nicol Bolas=20
napisa=B3:
>
>
>
> On Wednesday, February 6, 2013 7:25:09 PM UTC-8, Nevin ":-)" Liber wrote:
>>
>> On 6 February 2013 20:40, Nicol Bolas <jmck...@gmail.com> wrote:
>>
>>> That's really the question I have about this whole `optional<T&>` thing=
:=20
>>> what exactly is the use case for this functionality that `T*` can't als=
o=20
>>> cover?
>>>
>>
>> How about optional<T&&>?
>>
>
> I would say that should be illegal. Consider:
>
> T&& t1 =3D GetT();
> T t2(t1); //Calls copy constructor.
> T t3(std::move(t1)); //Explicit std::move required to cause move.
>
> optional<T&&> ot1 =3D GetOptT();
> T t2(*ot1); //Calls move constructor. No explicit std::move required.
>
> Much language was expended in the C++11 standard to ensure that you *must=
*use an explicit std::move for anything that isn't a temporary or the retur=
n=20
> from a variable that's going out of scope. optional<T&&> breaks this,=20
> allowing movement without the explicit use of std::move.
>
> optional<T&&>is dangerous.
>

And it is explicitly banned in the proposal.=20

--=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/?hl=3Den.



------=_Part_1105_16985628.1360223866535
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

<br><br>W dniu czwartek, 7 lutego 2013 04:55:22 UTC+1 u=BFytkownik Nicol Bo=
las napisa=B3:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><br><br>On Wedne=
sday, February 6, 2013 7:25:09 PM UTC-8, Nevin ":-)" Liber wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px=
 #ccc solid;padding-left:1ex"><div class=3D"gmail_quote">On 6 February 2013=
 20:40, Nicol Bolas <span dir=3D"ltr">&lt;<a>jmck...@gmail.com</a>&gt;</spa=
n> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex">

<div>That's really the question I have about this whole `optional&lt;T&amp;=
&gt;` thing: what exactly is the use case for this functionality that `T*` =
can't also cover?</div><div><div>

</div></div></blockquote></div><br>How about optional&lt;T&amp;&amp;&gt;?<b=
r></blockquote><div><br>I would say that should be illegal. Consider:<br><d=
iv style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187)=
;border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span=
 style=3D"color:#000"><br>T</span><span style=3D"color:#660">&amp;&amp;</sp=
an><span style=3D"color:#000"> t1 </span><span style=3D"color:#660">=3D</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#606">GetT</span=
><span style=3D"color:#660">();</span><span style=3D"color:#000"><br>T t2</=
span><span style=3D"color:#660">(</span><span style=3D"color:#000">t1</span=
><span style=3D"color:#660">);</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#800">//Calls copy constructor.</span><span style=3D"colo=
r:#000"><br>T t3</span><span style=3D"color:#660">(</span><span style=3D"co=
lor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"colo=
r:#000">move</span><span style=3D"color:#660">(</span><span style=3D"color:=
#000">t1</span><span style=3D"color:#660">));</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#800">//Explicit std::move required to cau=
se move.</span><span style=3D"color:#000"><br><br>optional</span><span styl=
e=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">&amp;&amp;&gt;</span><span style=3D"color:#000"> ot1 </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#606">GetOptT</span><span style=3D"color:#660">();</span=
><span style=3D"color:#000"><br>T t2</span><span style=3D"color:#660">(*</s=
pan><span style=3D"color:#000">ot1</span><span style=3D"color:#660">);</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#800">//Calls mov=
e constructor. No explicit std::move required.</span><span style=3D"color:#=
000"><br></span></div></code></div><br>Much language was expended in the C+=
+11 standard to ensure that you <i>must</i> use an explicit std::move for a=
nything that isn't a temporary or the return from a variable that's going o=
ut of scope. optional&lt;T&amp;&amp;&gt; breaks this, allowing movement wit=
hout the explicit use of std::move.</div><br>optional&lt;T&amp;&amp;&gt;is =
dangerous.<br></blockquote><div><br>And it is explicitly banned in the prop=
osal. <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/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_1105_16985628.1360223866535--

.
