220 3896 <CABsSThq1y3ixbWmJHYdu5UfWkbhgH5hU0RDnpSt-7jJ+CiR_sw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Faisal Vali <faisalv@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Possible to access invented template parameters
 in N3649 generic lambdas for perfect forwarding?
Date: Wed, 24 Apr 2013 10:12:01 -0500
Lines: 136
Approved: news@gmane.org
Message-ID: <CABsSThq1y3ixbWmJHYdu5UfWkbhgH5hU0RDnpSt-7jJ+CiR_sw@mail.gmail.com>
References: <efbd5c3c-1759-430a-bf07-914fee7e3915@isocpp.org>
	<CAFk2RUZpTZen0yd+aBF83nd830KX96m81VNxiPxSNX_Oj4yTLA@mail.gmail.com>
	<CAGNvRgDu+_TaRNY2V3O6ZwCWOJPzreQBM7kew2GtcSkkWBWmXw@mail.gmail.com>
	<CAEn_SPJHjva2D9rT8k6wDWA3Sq090jtJDnfhEmHeW7sNtmVxJQ@mail.gmail.com>
	<CAGNvRgADB22D900uUPj-BZELGWuxwAU86vuJ6E1v3PP=h4=7Vg@mail.gmail.com>
	<CABsSThqmytdKsyi-oeJ37XXbDjFKKZqG1oVQ=yr=-46qxUV7ww@mail.gmail.com>
	<fe96a916-b4ae-44d9-82dc-cdee94a7e0e6@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=14dae9340445553c7e04db1cb999
X-Trace: ger.gmane.org 1366816323 25108 80.91.229.3 (24 Apr 2013 15:12:03 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 24 Apr 2013 15:12:03 +0000 (UTC)
Cc: std-proposals@isocpp.org
To: rob.desbois@gmail.com
Original-X-From: std-proposals+bncBDDKRIXX5YARBRHM36FQKGQEFVA4G6A@isocpp.org Wed Apr 24 17:12:07 2013
Return-path: <std-proposals+bncBDDKRIXX5YARBRHM36FQKGQEFVA4G6A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ia0-f198.google.com ([209.85.210.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDDKRIXX5YARBRHM36FQKGQEFVA4G6A@isocpp.org>)
	id 1UV1Mb-000700-O4
	for gclcip-std-proposals@m.gmane.org; Wed, 24 Apr 2013 17:12:06 +0200
Original-Received: by mail-ia0-f198.google.com with SMTP id t4sf2757200iag.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 24 Apr 2013 08:12:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:received-spf:mime-version
         :x-received:reply-to:in-reply-to:references:date:message-id:subject
         :from:to:cc:x-original-sender:x-original-authentication-results
         :precedence:mailing-list:list-id:x-google-group-id:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe:content-type;
        bh=CtQShXXzaJ2ElymqWMlW+fYa3J8NhodJBFBWUXl3q/I=;
        b=D9jRiLmOAybKIq1lyg9lzxgaY0Gxd5Mw63g6kgtdXbrJGn/IxKbZgQ1hVhR2IMkToq
         iV1ajoQW8RtsHOohra4Tu8zdlueoJjuOGDxf3ApoGcumLL8y6dKvNyY3ISaAtTtgw9D4
         hi9eX8brwq+ZB3fRcKKzgQoUc+YEKdxSP4AfaOWUzLJyMeRuxOEQjnw4XQjWKc5cXtvw
         Gd3Z5ghtDhH8+f8ARayAsZHZGGmH2UA4bT4PmulpYymuyyp6R7aeHMdsQwHMiwBPOsmS
         IU9z5rIiBPzqtqsY3R1gcJBazirkpDrgc67GHrfNWkvL3jplZ9lOu6pdTykuMOMD3G9 
X-Received: by 10.43.62.4 with SMTP id wy4mr3871798icb.25.1366816324766;
        Wed, 24 Apr 2013 08:12:04 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.209.67 with SMTP id mk3ls3723912igc.5.canary; Wed, 24 Apr
 2013 08:12:03 -0700 (PDT)
X-Received: by 10.50.72.3 with SMTP id z3mr28132522igu.47.1366816323380;
        Wed, 24 Apr 2013 08:12:03 -0700 (PDT)
Original-Received: from mail-ie0-x229.google.com (mail-ie0-x229.google.com [2607:f8b0:4001:c03::229])
        by mx.google.com with ESMTPS id bb7si4048498icc.91.2013.04.24.08.12.02
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 24 Apr 2013 08:12:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of faisalv@gmail.com designates 2607:f8b0:4001:c03::229 as permitted sender) client-ip=2607:f8b0:4001:c03::229;
Original-Received: by mail-ie0-f169.google.com with SMTP id ar20so2227360iec.14
        for <std-proposals@isocpp.org>; Wed, 24 Apr 2013 08:12:01 -0700 (PDT)
X-Received: by 10.50.42.165 with SMTP id p5mr28524317igl.75.1366816321778;
 Wed, 24 Apr 2013 08:12:01 -0700 (PDT)
Original-Received: by 10.50.128.82 with HTTP; Wed, 24 Apr 2013 08:12:01 -0700 (PDT)
In-Reply-To: <fe96a916-b4ae-44d9-82dc-cdee94a7e0e6@isocpp.org>
X-Original-Sender: faisalv@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of faisalv@gmail.com designates 2607:f8b0:4001:c03::229 as permitted
 sender) smtp.mail=faisalv@gmail.com;       dkim=pass header.i=@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:3896
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/3896>

--14dae9340445553c7e04db1cb999
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Since there was initial confusion here on my part, I included the following
example in the wording (N3649) to illustrate the use of std::forward with
variadic auto:

 [ Example:
    auto glambda  =3D [](auto a, auto&& b) { return  a < b; };
  bool b =3D glambda(3, 3.14);       // OK
  auto vglambda =3D [](auto printer) {
     return [=3D](auto&& ... ts) {   // OK: ts is a  function parameter pac=
k
         printer(std::forward<decltype(ts)>(ts)...);  //<-- NOTE this line
         return [=3D]() {
           printer(ts ...);
         };
     };
  };

  auto p =3D vglambda( [](auto v1, auto v2, auto v3)
                         { std::cout << v1 << v2 << v3; } );
  auto q =3D p(1, 'a', 3.14);  // OK: outputs 1a3.14
  q();                       // OK: outputs 1a3.14
=97 end example]

Faisal Vali



On Wed, Apr 24, 2013 at 9:41 AM, <rob.desbois@gmail.com> wrote:

> On Wednesday, 24 April 2013 12:23:13 UTC+1, faisalv wrote:
>
>
>> On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler <daniel....@gmail.com>=
wrote:
>>
>>> > When used with identifiers, decltype returns the type they were
>>> declared
>>> > with.
>>>
>>> Yes, you are right, I was on the wrong track here.
>>>
>>
>> As was I, until Ville and Doug showed me the error of my ways  (while
>> discussing this in EWG).
>>
>>
>
> I think that is exactly what had me confused too
> Ville's 2nd proposed syntax looks like it'll do the trick.
>
> Thanks all :-)
> --rob
>

--=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.



--14dae9340445553c7e04db1cb999
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Since there was initial confusion here on my part, I inclu=
ded the following example in the wording (N3649) to illustrate the use of s=
td::forward with variadic auto:<br><br>=A0[ Example:<br>=A0=A0=A0 auto glam=
bda=A0 =3D [](auto a, auto&amp;&amp; b) { return=A0 a &lt; b; };<br>
=A0 bool b =3D glambda(3, 3.14);=A0=A0=A0=A0=A0=A0 // OK<br>=A0 auto vglamb=
da =3D [](auto printer) {<br>=A0=A0=A0=A0 return [=3D](auto&amp;&amp; ... t=
s) {=A0=A0 // OK: ts is a=A0 function parameter pack<br>=A0=A0=A0=A0=A0=A0=
=A0=A0 printer(std::forward&lt;decltype(ts)&gt;(ts)...);=A0 //&lt;-- NOTE t=
his line<br>
=A0=A0=A0=A0=A0=A0=A0=A0 return [=3D]() {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 printer(ts ...);<br>=A0=A0=A0=A0=A0=A0=A0=A0 };<br>=A0=A0=A0=A0 };<br>=A0 =
};<br><br>=A0 auto p =3D vglambda( [](auto v1, auto v2, auto v3)=A0=A0=A0 <=
br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 { std::cout &lt;&lt; v1 &lt;&lt; v2 &lt;&lt; v3; } );<br>
=A0 auto q =3D p(1, &#39;a&#39;, 3.14);=A0 // OK: outputs 1a3.14<br>=A0 q()=
;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // OK: =
outputs 1a3.14<br>=97 end example]<br></div><div class=3D"gmail_extra"><br =
clear=3D"all"><div>Faisal Vali<br><br></div>
<br><br><div class=3D"gmail_quote">On Wed, Apr 24, 2013 at 9:41 AM,  <span =
dir=3D"ltr">&lt;<a href=3D"mailto:rob.desbois@gmail.com" target=3D"_blank">=
rob.desbois@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x">
On Wednesday, 24 April 2013 12:23:13 UTC+1, faisalv  wrote:<div class=3D"im=
"><br><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex=
;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><div><di=
v class=3D"gmail_quote">
On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler <span dir=3D"ltr">&lt;<a>=
daniel....@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>&gt; When used with identifiers, declty=
pe returns the type they were declared<br>
&gt; with.<br>
<br>
</div>Yes, you are right, I was on the wrong track here.<br>
<span></span></blockquote><div><br></div><div>As was I, until Ville and Dou=
g showed me the error of my ways=A0 (while discussing this in EWG).<br>=A0<=
br></div></div></div></div></blockquote><div><br></div></div><div>I think t=
hat is exactly what had me confused too</div>
<div>Ville&#39;s 2nd proposed syntax looks like it&#39;ll do the trick.</di=
v><div><br></div><div>Thanks all :-)</div><div>--rob</div></blockquote></di=
v><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 />

--14dae9340445553c7e04db1cb999--

.
