220 6766 <b0fea25c-5e03-408e-b93a-14061c41a3ef@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Revision of N3702: Introducing an optional
 parameter for mem_fn.
Date: Sun, 29 Sep 2013 07:21:36 -0700 (PDT)
Lines: 140
Approved: news@gmane.org
Message-ID: <b0fea25c-5e03-408e-b93a-14061c41a3ef@isocpp.org>
References: <f0fa2e29-b024-4fa9-a12c-99d3f8599461@isocpp.org>
 <d92e0d83-366a-4ef0-8df2-c17994ab0755@isocpp.org> <0ffade3d-ac13-434c-b20a-85d611783fc1@isocpp.org>
 <2284c2d2-ec8e-43fb-90e7-c43ac9dc92c2@isocpp.org> <505813ae-956c-4693-b793-2ba47107c09c@isocpp.org>
 <CANh-dXnis=-E_PvEz4L+RAHmz5aqcnKZqqYfhwX0WM0vSC9MKw@mail.gmail.com>
 <a15d9ee3-a062-4309-9798-21203e5c2280@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_1527_15706187.1380464496782"
X-Trace: ger.gmane.org 1380464496 3896 80.91.229.3 (29 Sep 2013 14:21:36 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 29 Sep 2013 14:21:36 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDC55PNFRYGRB4XOUCJAKGQEXJ55XJY@isocpp.org Sun Sep 29 16:21:40 2013
Return-path: <std-proposals+bncBDC55PNFRYGRB4XOUCJAKGQEXJ55XJY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f200.google.com ([209.85.214.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDC55PNFRYGRB4XOUCJAKGQEXJ55XJY@isocpp.org>)
	id 1VQHsR-0006wN-Rp
	for gclcip-std-proposals@m.gmane.org; Sun, 29 Sep 2013 16:21:40 +0200
Original-Received: by mail-ob0-f200.google.com with SMTP id gq1sf17606364obb.7
        for <gclcip-std-proposals@m.gmane.org>; Sun, 29 Sep 2013 07:21:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=a+hLqTChYfvj4g7g8d54Xo6F5sJ0BAe+Pmzp/4p8e9U=;
        b=mm42yOI9csiQT+PGbw0MwSIIS8bHABLkJ8SV/c5EWEGb0akyseVNye8YpQiOTcSQR5
         N17lV5UQ+LsbMPs21LcADsihgv7wkAxcbe3V12WvW5j+Dp4op2xbwbUZARgLorQAZsBP
         j1VZkl18I80MDyri2cmwD3sRvDfEX8frqm22zYKDX9GWkQLEXJCGLhN33FMOJ800AtGn
         3HzGIGUML1xJZZddVw2wE+KLRxlk5Y/gFAW1sUFtO1pcHha36vbuElFZOrcG1b4nHj/n
         DWnD+jGjcJ6GsYOHgX97pkAfYuw22RuzsCmtmfHufoaAwz7LyaipmY0QpaXJW0tOv2p4
         rMHg==
X-Received: by 10.50.7.65 with SMTP id h1mr9175373iga.4.1380464498895;
        Sun, 29 Sep 2013 07:21:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.8.39 with SMTP id o7ls1439649iga.28.gmail; Sun, 29 Sep 2013
 07:21:38 -0700 (PDT)
X-Received: by 10.50.11.16 with SMTP id m16mr307910igb.0.1380464498207;
        Sun, 29 Sep 2013 07:21:38 -0700 (PDT)
In-Reply-To: <a15d9ee3-a062-4309-9798-21203e5c2280@isocpp.org>
X-Original-Sender: mikhailsemenov1957@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:6766
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/6766>

------=_Part_1527_15706187.1380464496782
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

N3690, page 90, example:
=20

return [=3D](auto&& ... ts) { // OK: ts is a function parameter pack
printer(std::forward<decltype(ts)>(ts)...);

....

=20

The* decltype(ts),* not* decltype(auto),* otherwise the type is not clear.

=20

As for the return *-> decltype(auto)*, it was always optional for lambdas,=
=20
especially it there is one return statement.

=20

=20

=20

=20
=20

On Sunday, September 29, 2013 1:17:56 PM UTC+1, toma...@gmail.com wrote:

>
>
> W dniu niedziela, 29 wrze=B6nia 2013 06:26:18 UTC+2 u=BFytkownik Jeffrey=
=20
> Yasskin napisa=B3:
>>
>> Thanks for the proposals. The Library Evolution group in Chicago=20
>> reviewed mem_fn and concluded that it's generally not worth extending=20
>> the callable wrappers, and that users should just use lambdas in=20
>> nearly all cases. C++14's generic lambdas with variadic captures make=20
>> this an even better tradeoff (note, I didn't compile this):=20
>>
>>  double r =3D integrate=20
>>               ([&a](const auto&... args) { return a.fa(args...);},=20
>>                  x1, x2, y1, y2, z1, z2, a1, a2, b1, b2);=20
>>
>> To work with any parameter/return (references) type combination, this=20
> should be written as:
>  double r =3D integrate(
>               [&a](auto&&... args) -> decltype(auto)
>               { return a.fa(std::forward<decltype(auto)>(args)...); });
>
> Which is pretty less readable and less intent clear than:
>  double r =3D integrate(std::mem_fn(&A::a, std::ref(a)));
>
> In my opinion the deifference between this 2 cases may be compared with=
=20
> the diference between using
> hand-writtern loop versus algorithm.
>

--=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_1527_15706187.1380464496782
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>N3690, page 90, example:</div><div>&nbsp;</div><div><=
font face=3D"LMMono9-Regular" size=3D"1"><font face=3D"LMMono9-Regular" siz=
e=3D"1"><p align=3D"LEFT">return [=3D](auto&amp;&amp; ... ts) { // OK: ts i=
s a function parameter pack<br>printer(std::forward&lt;decltype(ts)&gt;(ts)=
....);<p align=3D"LEFT">...<p align=3D"LEFT">&nbsp;<p align=3D"LEFT">The<str=
ong> decltype(ts),</strong> not<strong> decltype(auto),</strong> otherwise =
the type is not clear.<p align=3D"LEFT">&nbsp;<p align=3D"LEFT">As for the =
return <font face=3D"Courier New"><strong>-&gt; decltype(auto)</strong>, it=
 was always optional for lambdas, especially it there is one return stateme=
nt.</font><br><p align=3D"LEFT">&nbsp;<p align=3D"LEFT">&nbsp;<p align=3D"L=
EFT">&nbsp;</p></font></font><font face=3D"LMMono9-Regular" size=3D"1"><fon=
t face=3D"LMMono9-Regular" size=3D"1"><p>&nbsp;</p></font></font></div><div=
>&nbsp;</div><div><br>On Sunday, September 29, 2013 1:17:56 PM UTC+1, toma.=
...@gmail.com wrote:</div><blockquote class=3D"gmail_quote" style=3D"margin:=
 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204=
); border-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><br>=
<br>W dniu niedziela, 29 wrze=B6nia 2013 06:26:18 UTC+2 u=BFytkownik Jeffre=
y Yasskin napisa=B3:<blockquote class=3D"gmail_quote" style=3D"margin: 0px =
0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); bo=
rder-left-width: 1px; border-left-style: solid;">Thanks for the proposals. =
The Library Evolution group in Chicago
<br>reviewed mem_fn and concluded that it's generally not worth extending
<br>the callable wrappers, and that users should just use lambdas in
<br>nearly all cases. C++14's generic lambdas with variadic captures make
<br>this an even better tradeoff (note, I didn't compile this):
<br>
<br>&nbsp;double r =3D integrate
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ([&amp;a](const auto&a=
mp;... args) { return a.fa(args...);},
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x1, x2, y=
1, y2, z1, z2, a1, a2, b1, b2);
<br>
<br></blockquote><div>To work with any parameter/return (references) type c=
ombination, this should be written as:<br><span style=3D"font-family: couri=
er new,monospace;">&nbsp;double r =3D integrate(<br>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [&amp;a](auto&amp;&=
amp;... args) -&gt; decltype(auto)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; { return a.fa(std::forward&lt;decltype(<wbr>auto)&gt;(args)...)=
; });</span><br><br>Which is pretty less readable and less intent clear tha=
n:<br><span style=3D"font-family: courier new,monospace;">&nbsp;double r =
=3D integrate(std::mem_fn(&amp;A::a, std::ref(a)));<br><br><font face=3D"ar=
ial,sans-serif">In my opinion the deifference between this 2 cases may be c=
ompared with the diference between using<br>hand-writtern loop versus algor=
ithm.<br></font></span></div></div></blockquote></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 />

------=_Part_1527_15706187.1380464496782--

.
