220 17430 <0c39ed29-d389-4894-bc65-71a9bb79cbe5@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Avi Kivity <avi@cloudius-systems.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Proposal: lambda move capture
Date: Sun, 19 Apr 2015 07:06:02 -0700 (PDT)
Lines: 65
Approved: news@gmane.org
Message-ID: <0c39ed29-d389-4894-bc65-71a9bb79cbe5@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2138_123544281.1429452362233"
X-Trace: ger.gmane.org 1429452366 1858 80.91.229.3 (19 Apr 2015 14:06:06 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 19 Apr 2015 14:06:06 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDHJFOWD7YCRBS7MZ2UQKGQEX4VWIFA@isocpp.org Sun Apr 19 16:06:06 2015
Return-path: <std-proposals+bncBDHJFOWD7YCRBS7MZ2UQKGQEX4VWIFA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f197.google.com ([209.85.192.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDHJFOWD7YCRBS7MZ2UQKGQEX4VWIFA@isocpp.org>)
	id 1YjprJ-0007Zb-HO
	for gclcip-std-proposals@m.gmane.org; Sun, 19 Apr 2015 16:06:05 +0200
Original-Received: by pdbqd1 with SMTP id qd1sf250217754pdb.1
        for <gclcip-std-proposals@m.gmane.org>; Sun, 19 Apr 2015 07:06:03 -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:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=fFpioEtEQbWYIXpOnq2FDgbm770tAUNhC6OkJuXU7XU=;
        b=YXVfg+af2Y9GfB7egeS8svhA6JJZzd+aJRrB7dpmjsatZ/an7yXeG1L77oP3aN3BH3
         f4t6S++9qEHx4bz6Wi4cw3vz2WYdrPy6+4sdKMiMttngyha1NdSObz2kp2KvhK2Jbobw
         OGMCLAJpE4ZQAvBv2AZ42Vb7xuLTwwlP75xwNY5iKRH+tcuGvwAImU4hj1Rhosl4ECkR
         Rr+IKztVWd0z3TYvrczxNnx5tLQPiLWYB+tyAJyHJuZ9VCGuUf1HJgYd175wqndRWlax
         U7Tjydf/b1Uz/dfR1nHLwwmzdg0FrJpidp+59y1W7pv0SVUIn+Jbux0JjhaFDs2O21Bq
         gdOQ==
X-Gm-Message-State: ALoCoQn0b9HAB8XB48qvxZIGXduphFk7SYKZ+zcJnAsc8UpSDvSuiNz60h8acaQWzdl0XPDX+i8q
X-Received: by 10.66.218.10 with SMTP id pc10mr16172833pac.13.1429452363875;
        Sun, 19 Apr 2015 07:06:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.109.230 with SMTP id l93ls2359028qgf.39.gmail; Sun, 19 Apr
 2015 07:06:03 -0700 (PDT)
X-Received: by 10.140.98.175 with SMTP id o44mr157107qge.33.1429452363062;
        Sun, 19 Apr 2015 07:06:03 -0700 (PDT)
X-Original-Sender: avi@cloudius-systems.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:17430
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/17430>

------=_Part_2138_123544281.1429452362233
Content-Type: multipart/alternative; 
	boundary="----=_Part_2139_1939527765.1429452362234"

------=_Part_2139_1939527765.1429452362234
Content-Type: text/plain; charset=UTF-8

Lambdas currently support three styles of capture:

1. Init capture (fully generic) [x = expression]
2. Copy capture: [x], equivalent to [x = x]
3. Reference capture: [&x], roughly equivalent to [x = std::ref(x)]

As I find myself typing [x = std::move(x)] more and more, I propose to 
support a fourth style:

4. Move capture: [&&x], equivalent to [x = std::move(x)]

This would be very useful for move-only types such as unique_ptr<>.

(the idea has been proposed before on the comp.std.c++ newsgroup)


-- 

--- 
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_2139_1939527765.1429452362234
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Lambdas currently support three styles of capture:<div><br=
></div><div>1. Init capture (fully generic) [x =3D expression]</div><div>2.=
 Copy capture: [x], equivalent to [x =3D x]</div><div>3. Reference capture:=
 [&amp;x], roughly equivalent to [x =3D std::ref(x)]</div><div><br></div><d=
iv>As I find myself typing [x =3D std::move(x)] more and more, I propose to=
 support a fourth style:</div><div><br></div><div>4. Move capture: [&amp;&a=
mp;x], equivalent to [x =3D std::move(x)]</div><div><br></div><div>This wou=
ld be very useful for move-only types such as unique_ptr&lt;&gt;.</div><div=
><br></div><div>(the idea has been proposed before on the comp.std.c++ news=
group)<br><div><br></div><div><br></div></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_2139_1939527765.1429452362234--
------=_Part_2138_123544281.1429452362233--

.
