220 12799 <85BDB38C-F54A-43AA-9DF7-09AB26E4E65E@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Local variables that overstay their welcome
Date: Thu, 11 Sep 2014 09:35:57 +0800
Lines: 69
Approved: news@gmane.org
Message-ID: <85BDB38C-F54A-43AA-9DF7-09AB26E4E65E@gmail.com>
References: <778b6fbf-3b58-488c-9e51-32a05b95831e@isocpp.org> <94e564fc-f769-48d0-8a61-264f9c8f8480@isocpp.org> <66580c5b-0db4-4925-a4bd-9a5ef8f0c6c1@isocpp.org> <CADbh+eTuk_WB_ip6hp9Ai5aSFRakEQtrBtKae+OcKXb2nJgPWw@mail.gmail.com> <882aefbd-b21e-4ed3-8d08-f5cc8444f8ae@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_9B72862E-3CA4-4C8C-9C67-3434E3CB700E"
X-Trace: ger.gmane.org 1410399387 13847 80.91.229.3 (11 Sep 2014 01:36:27 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 11 Sep 2014 01:36:27 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBCXZYOQAKGQEBLO5EDA@isocpp.org Thu Sep 11 03:36:20 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBCXZYOQAKGQEBLO5EDA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f199.google.com ([209.85.192.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBCXZYOQAKGQEBLO5EDA@isocpp.org>)
	id 1XRtIy-0006Zl-2E
	for gclcip-std-proposals@m.gmane.org; Thu, 11 Sep 2014 03:36:12 +0200
Original-Received: by mail-pd0-f199.google.com with SMTP id v10sf60896941pde.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 10 Sep 2014 18:36:10 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:mime-version:subject:date
         :references:to:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=fgBSst88dQeh4NGJ2uvxRtqsG5x7kU0157J9+Dbfhz0=;
        b=JjtpfAq3GlAl85OaMTWtZGMMd41yOEIjNULOAXaMnzfjmZfTTEBoq4zEJ+N+BGnSv3
         c4zJdWZKiaXrLJaR7AbgicrauPDzlPWUUcf/9eJVyFeVD6Kp1vMeqM1tKwO3DNTeDJdE
         tjXOvCmXy+HwFk+Jq+TjP7NG3bW/iVI8ylTgRcPCZBoDZ/RmdxQN0kJyDiJq0gO9ZNLz
         RvJ5HhnpAxFLCZH14w32bwLW1rCcpPI2AfPClV8ufhcZ2rd2Vwrilc9LUAW7HO1PgYQh
         U7IXYmhK8jDL6X70o3FfHcBBiRvokYvD/J2ELZVNpPqxIz2Q0LCAyHpOXbRcfK1qFbYv
         IOlg==
X-Gm-Message-State: ALoCoQn79kcxQapGFlG+P06a3juso6kX382C2jv1jkQoWwyRzPkcd7WWIDrGLfza1VrqKKFoZI5W
X-Received: by 10.66.190.67 with SMTP id go3mr27880697pac.10.1410399370758;
        Wed, 10 Sep 2014 18:36:10 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.117.72 with SMTP id kc8ls3505484igb.37.canary; Wed, 10 Sep
 2014 18:36:10 -0700 (PDT)
X-Received: by 10.66.65.195 with SMTP id z3mr57419891pas.116.1410399370025;
        Wed, 10 Sep 2014 18:36:10 -0700 (PDT)
Original-Received: from mail-pd0-x232.google.com (mail-pd0-x232.google.com [2607:f8b0:400e:c02::232])
        by mx.google.com with ESMTPS id ns9si25289591pdb.221.2014.09.10.18.36.10
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 10 Sep 2014 18:36:10 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c02::232 as permitted sender) client-ip=2607:f8b0:400e:c02::232;
Original-Received: by mail-pd0-f178.google.com with SMTP id p10so9247089pdj.23
        for <std-proposals@isocpp.org>; Wed, 10 Sep 2014 18:36:09 -0700 (PDT)
X-Received: by 10.66.65.133 with SMTP id x5mr68675405pas.26.1410399369902;
        Wed, 10 Sep 2014 18:36:09 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.59])
        by mx.google.com with ESMTPSA id hp1sm15606024pbb.77.2014.09.10.18.36.08
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 10 Sep 2014 18:36:09 -0700 (PDT)
In-Reply-To: <882aefbd-b21e-4ed3-8d08-f5cc8444f8ae@isocpp.org>
X-Mailer: Apple Mail (2.1878.6)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:400e:c02::232 as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=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>, <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:12799
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/12799>

--Apple-Mail=_9B72862E-3CA4-4C8C-9C67-3434E3CB700E
Content-Type: text/plain; charset=ISO-8859-1


On 2014-09-11, at 9:09 AM, Chet <chet.skolos@gmail.com> wrote:

> Adding a "disengage and move from" method to optional is good idea.

It would probably be best if the idiom for moving from an optional would disengage it, so that would be the default.

Food for thought. 

It would be doable with an rvalue-qualified conversion function, but it would have to return by (pr)value. Returning an xvalue wouldn't give it a chance to destroy the contained object after entering the disengaged state.

Alternately, std::move() could be overloaded for optional, and return a proxy object which converts to an xvalue and enters the disengaged state upon (temporary proxy) destruction. But that's dirty enough to have undesirable side-effects.

-- 

--- 
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/.

--Apple-Mail=_9B72862E-3CA4-4C8C-9C67-3434E3CB700E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;09&ndash;11, at 9:09 AM, Chet &lt;<a href=3D"mailto:chet.skolos@gmail=
..com">chet.skolos@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-intercha=
nge-newline"><blockquote type=3D"cite"><div style=3D"font-family: Helvetica=
; font-size: 12px; font-style: normal; font-variant: normal; font-weight: n=
ormal; letter-spacing: normal; line-height: normal; orphans: auto; text-ali=
gn: start; text-indent: 0px; text-transform: none; white-space: normal; wid=
ows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir=3D"=
ltr"><div>Adding a "disengage and move from" method to optional is good ide=
a.</div></div></div></blockquote><br></div><div>It would probably be best i=
f the idiom for moving from an optional would disengage it, so that would b=
e the default.</div><div><br></div><div>Food for thought.&nbsp;</div><div><=
br></div><div><div>It would be doable with an rvalue-qualified conversion f=
unction, but it would have to return by (pr)value. Returning an xvalue woul=
dn&rsquo;t give it a chance to destroy the contained object after entering =
the disengaged state.</div><div><br></div><div>Alternately, std::move() cou=
ld be overloaded for optional, and return a proxy object which converts to =
an xvalue and enters the disengaged state upon (temporary proxy) destructio=
n. But that&rsquo;s dirty enough to have undesirable side-effects.</div><di=
v><br></div></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=_9B72862E-3CA4-4C8C-9C67-3434E3CB700E--

.
