220 5025 <51bf2631-aed7-4433-b16d-15ee15e87f29@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: tomaszkam@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Require that this should be always caputred by copy.
Date: Thu, 13 Jun 2013 13:16:49 -0700 (PDT)
Lines: 177
Approved: news@gmane.org
Message-ID: <51bf2631-aed7-4433-b16d-15ee15e87f29@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_1_13674258.1371154609502"
X-Trace: ger.gmane.org 1371155964 27381 80.91.229.3 (13 Jun 2013 20:39:24 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 13 Jun 2013 20:39:24 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDNPVXXG6IGBB6W35CGQKGQEIKR6DUQ@isocpp.org Thu Jun 13 22:39:25 2013
Return-path: <std-proposals+bncBDNPVXXG6IGBB6W35CGQKGQEIKR6DUQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gh0-f197.google.com ([209.85.160.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDNPVXXG6IGBB6W35CGQKGQEIKR6DUQ@isocpp.org>)
	id 1UnEIm-0005mJ-3j
	for gclcip-std-proposals@m.gmane.org; Thu, 13 Jun 2013 22:39:24 +0200
Original-Received: by mail-gh0-f197.google.com with SMTP id r20sf6300696ghr.8
        for <gclcip-std-proposals@m.gmane.org>; Thu, 13 Jun 2013 13:39:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:date:from:to:message-id: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=xHs4Qx3lz3SppivJyKl1PAyKddEqkL3+bMhMDG8cwds=;
        b=c+fvQisBKxD8BqZ16mkmtt3ivWJHJunrq2fZZoYtbiq/BNTC7TWEgIyMBGpTj/YTRs
         scMV+bgA9ovfNInlvdaKn9F0dSjeirDv7c2jonL/0QO71TsB+0hVOw7/gFoz6UQbtn0a
         r213FYQHI3vftuHF3BJ15xPy+2/NHKW8kc7Siljl8RrpMj5poR9zpPC++VL26mbtYQWR
         MPbYwPm5mrtfPfEl4mrhr42IPy/xA0HMYi10XCP8hZfr8CdJh7jdtL4zfgn9shNgXjqN
         Cw4uHGR3HhvVpbvkZJaKZaOP1Qs2WQmr+2gOUwgWSH2WR4hX/xp6UNSYIv5AdqaLm9GJ
         n7MA==
X-Received: by 10.236.55.129 with SMTP id k1mr1226982yhc.1.1371155962596;
        Thu, 13 Jun 2013 13:39:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.60.200 with SMTP id j8ls1172352qer.42.gmail; Thu, 13 Jun
 2013 13:39:21 -0700 (PDT)
X-Received: by 10.224.42.141 with SMTP id s13mr2269164qae.3.1371155961586;
        Thu, 13 Jun 2013 13:39:21 -0700 (PDT)
Original-Received: by 10.224.181.75 with SMTP id bx11msqab;
        Thu, 13 Jun 2013 13:16:50 -0700 (PDT)
X-Received: by 10.49.3.37 with SMTP id 5mr127780qez.30.1371154609925;
        Thu, 13 Jun 2013 13:16:49 -0700 (PDT)
X-Original-Sender: tomaszkam@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: <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:5025
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5025>

------=_Part_1_13674258.1371154609502
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Currently the standard (C++14 CD - NS3690) disallows explicit capture of=20
this by reference the this seems to be allowed to be captured implicit by=
=20
reference by the [&]. $5.1.2:
15. An entity is captured by copy if it is implicitly captured and the=20
capture-default is =3D or if it is explicitly
captured with a capture that does not include an &. For each entity=20
captured by copy, an unnamed non-
static data member is declared in the closure type. The declaration order=
=20
of these members is unspecified.
The type of such a data member is the type of the corresponding captured=20
entity if the entity is not a
reference to an object, or the referenced type otherwise. [ Note: If the=20
captured entity is a reference to a
function, the corresponding data member is also a reference to a function.=
=20
=97 end note ] An array of runtime
bound (8.3.4) shall not be captured by copy.
16. An entity is captured by reference if it is implicitly or explicitly=20
captured but not captured by copy. It is
unspecified whether additional unnamed non-static data members are declared=
=20
in the closure type for entities
captured by reference. [ Note: Capturing by reference an array of runtime=
=20
bound also
.. See also. this questions.<http://stackoverflow.com/questions/12718064/und=
erstanding-in-c-lambda-capture-specification>

Contrary the statement $5.1.2/18:
Every id-expression that is an odr-use (3.2) of an entity captured by copy=
=20
is transformed into an access to the
corresponding unnamed data member of the closure type. [ Note: An=20
id-expression that is not an odr-use
refers to the original entity, never to a member of the closure type.=20
Furthermore, such an id-expression
does not cause the implicit capture of the entity. =97 end note ] *If this =
is=20
captured, each odr-use of this
is transformed into an access to the corresponding unnamed data member of=
=20
the closure type, cast (5.4)
to the type of this.* [ Note: The cast ensures that the transformed=20
expression is a prvalue. =97 end note ]
Sugest that this is always stored in separate unnamed member of closuer=20
type, which with combination with $5.1.2/16:
An entity is captured by reference if it is implicitly or explicitly=20
captured but not captured by copy.* It is
unspecified whether additional unnamed non-static data members are declared=
=20
in the closure type for entities
captured by reference. *[ Note: Capturing by reference an array of runtime=
=20
bound also implicitly captures
the value of the bound to support the range-based for statement (6.5.4). =
=97=20
end note ]
So in combination this to statement suggests that this is always captured=
=20
by copy.

Is this the issue in the standard wording and the this was designed to be=
=20
always captured by value? If so the point be changed to explicitly mention=
=20
this.
15. An entity is captured by copy if it is *this or* implicitly captured=20
and the capture-default is =3D or if it is explicitly
captured with a capture that does not include an &. For each entity=20
captured by copy, an unnamed non-
static data member is declared in the closure type. The declaration order=
=20
of these members is unspecified.
The type of such a data member is the type of the corresponding captured=20
entity if the entity is not a
reference to an object, or the referenced type otherwise. [ Note: If the=20
captured entity is a reference to a
function, the corresponding data member is also a reference to a function.=
=20
=97 end note ] An array of runtime
bound (8.3.4) shall not be captured by copy.

--=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/.



------=_Part_1_13674258.1371154609502
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Currently the standard (C++14 CD - NS3690) disallows explicit capture of th=
is by reference the this seems to be allowed to be captured implicit by ref=
erence by the [&amp;]. $5.1.2:<br><span style=3D"font-family: courier new,m=
onospace;">15. An entity is captured by copy if it is implicitly captured a=
nd the capture-default is =3D or if it is explicitly<br>captured with a cap=
ture that does not include an &amp;. For each entity captured by copy, an u=
nnamed non-<br>static data member is declared in the closure type. The decl=
aration order of these members is unspecified.<br>The type of such a data m=
ember is the type of the corresponding captured entity if the entity is not=
 a<br>reference to an object, or the referenced type otherwise. [ Note: If =
the captured entity is a reference to a<br>function, the corresponding data=
 member is also a reference to a function. =97 end note ] An array of runti=
me<br>bound (8.3.4) shall not be captured by copy.<br>16. An entity is capt=
ured by reference if it is implicitly or explicitly captured but not captur=
ed by copy. It is<br>unspecified whether additional unnamed non-static data=
 members are declared in the closure type for entities<br>captured by refer=
ence. [ Note: Capturing by reference an array of runtime bound also</span><=
br>. See also. <a href=3D"http://stackoverflow.com/questions/12718064/under=
standing-in-c-lambda-capture-specification">this questions.</a><br><br>Cont=
rary the statement $5.1.2/18:<br><span style=3D"font-family: courier new,mo=
nospace;">Every id-expression that is an odr-use (3.2) of an entity capture=
d by copy is transformed into an access to the<br>corresponding unnamed dat=
a member of the closure type. [ Note: An id-expression that is not an odr-u=
se<br>refers to the original entity, never to a member of the closure type.=
 Furthermore, such an id-expression<br>does not cause the implicit capture =
of the entity. =97 end note ] <b>If this is captured, each odr-use of this<=
br>is transformed into an access to the corresponding unnamed data member o=
f the closure type, cast (5.4)<br>to the type of this.</b> [ Note: The cast=
 ensures that the transformed expression is a prvalue. =97 end note ]<br><f=
ont face=3D"arial,sans-serif">Sugest that this is always stored in separate=
 unnamed member of closuer type, which with combination with $5.1.2/16:<br>=
<span style=3D"font-family: courier new,monospace;">An entity is captured b=
y reference if it is implicitly or explicitly captured but not captured by =
copy.<b> It is<br>unspecified whether additional unnamed non-static data me=
mbers are declared in the closure type for entities<br>captured by referenc=
e. </b>[ Note: Capturing by reference an array of runtime bound also implic=
itly captures<br>the value of the bound to support the range-based for stat=
ement (6.5.4). =97 end note ]</span><br></font></span>So in combination thi=
s to statement suggests that this is always captured by copy.<br><br>Is thi=
s the issue in the standard wording and the this was designed to be always =
captured by value? If so the point be changed to explicitly mention this.<b=
r><span style=3D"font-family: courier new,monospace;">15. An entity is capt=
ured by copy if it is <span style=3D"color: rgb(0, 0, 0);"><u>this or</u> <=
/span>implicitly captured and the capture-default is =3D or if it is explic=
itly<br>captured with a capture that does not include an &amp;. For each en=
tity captured by copy, an unnamed non-<br>static data member is declared in=
 the closure type. The declaration order of these members is unspecified.<b=
r>The type of such a data member is the type of the corresponding captured =
entity if the entity is not a<br>reference to an object, or the referenced =
type otherwise. [ Note: If the captured entity is a reference to a<br>funct=
ion, the corresponding data member is also a reference to a function. =97 e=
nd note ] An array of runtime<br>bound (8.3.4) shall not be captured by cop=
y.</span><br>

<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_1_13674258.1371154609502--

.
