220 26216 <0aa49f06-08b0-433a-a897-720140eb7097@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Greg Marr <gregmmarr@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: statement folding on variadic templates
 parameters pack
Date: Wed, 8 Jun 2016 08:11:21 -0700 (PDT)
Lines: 128
Approved: news@gmane.org
Message-ID: <0aa49f06-08b0-433a-a897-720140eb7097@isocpp.org>
References: <1e3daa7c-e10a-4589-8118-26f47bc1a0df@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_649_1412130046.1465398681382"
X-Trace: ger.gmane.org 1465398948 659 80.91.229.3 (8 Jun 2016 15:15:48 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 8 Jun 2016 15:15:48 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDEZH3XFPIIJV27AXICRUBEDI55JG@isocpp.org Wed Jun 08 17:15:44 2016
Return-path: <std-proposals+bncBDEZH3XFPIIJV27AXICRUBEDI55JG@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f71.google.com ([209.85.214.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDEZH3XFPIIJV27AXICRUBEDI55JG@isocpp.org>)
	id 1bAf8e-0004EW-2I
	for gclcip-std-proposals@m.gmane.org; Wed, 08 Jun 2016 17:11:24 +0200
Original-Received: by mail-it0-f71.google.com with SMTP id z189sf21849224itg.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 08 Jun 2016 08:11:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=bZFPnZ6zJpVQwS0rcu3Bs3v5vErDY6WMLbdc4qU2chQ=;
        b=XryYJLPgYqa3weAZ0u3ohSgQdvWU4YAf3HqI+dsINOZaWXN7maqRnOYc3t0oD61UxV
         q7x2zIaYAcG8/5Tq3uNOk4NF3uPHVXgu6tat0gGJG+Fw4kKkn56eBs0Axxk0TGlF3lox
         aP6+ccPAqOQcdOHL4cvtBFA/RO+ZaPGptRjF2zeBYw8VZ2RnQ3R0LKOC9fSFmo+ZonTx
         IVG3KW6U6h9Bf/t/nEK7mv7hjHGdpiNxr190u5aDR0n//6hg0ouRfA0r7s7DYDEGs5dG
         5HogPoGnZzbX/zv9/QnQvP88Igr4RHUTSmKjFE86nrq8JXCSxd86ZToArjmT3Y2qK1Ej
         0PbQ==
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
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=bZFPnZ6zJpVQwS0rcu3Bs3v5vErDY6WMLbdc4qU2chQ=;
        b=x3YZmjwQPaRN6jy2EX83vPA9HTPIzR1JZKAGMBa/lC9NSCZTRf364CxrwQNaBNYvRC
         do8gpCNNuE8Nb4xkrAxdtgcZ75emYh0mh2BAN06+6KFgsDZUb2JwtCZkKrCKcWLXk4T4
         XjCZpe4XsMewUS9tSYZTtlVcJVbHsBqjtSEURmL9Csm73evPnfu7YqLTuFrOT1NpDhR0
         8humtXupiPDl+lLNl0tSdW3ehk7728x8qFAnsZDxBBNdhVLBGq34E7VHY2bkFLItZETl
         Aqw7zQbBUIxfxCTpmrAraj9u/9COP9PCLpuMAFO2+Tam0iU4M9BOuoSbUmyN5zAv8zMe
         vB1A==
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:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=bZFPnZ6zJpVQwS0rcu3Bs3v5vErDY6WMLbdc4qU2chQ=;
        b=d3MMKDCLh3zxB5t5i+tD6j019gSKKsWHXUmt88Bsuy7iyV1vdqUVdPLnX7LBfxufZ7
         +6fkMp+QQ/lwyjlgxZakTPbz+px8cO2n2TMyvgkARQFYUHBdR1bOqsqY7Z0GdujAfe+p
         mMYXkfp3DTEixUxRR6zexFQ0TmZ8vAgHQarh2IMO0TZXZQP3Znl7iy5WEXFpJPmfktZr
         RkYoG03TQqKFuY5q2Kq4t3kWUZroTaCvyH/BjXV9Y8tqM4h7YaRTR3k90iC+tja66Pf9
         aL0pbntIrFq6dNfE+rrjEWlBJY90me5mHZblDX+o2mgrwIbEzWiPQ1e7iZadozqQySoF
         slOw==
X-Gm-Message-State: ALyK8tLniRIzCBnhg3k3SkgEKoiHqRjssgHzPv2e7ITgKWZHrwADhX0mowT5LfLruYNlig==
X-Received: by 10.36.118.79 with SMTP id z76mr5951844itb.1.1465398683195;
        Wed, 08 Jun 2016 08:11:23 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.174.7 with SMTP id x7ls162462ioe.53.gmail; Wed, 08 Jun
 2016 08:11:22 -0700 (PDT)
X-Received: by 10.36.103.17 with SMTP id u17mr324146itc.4.1465398682206;
        Wed, 08 Jun 2016 08:11:22 -0700 (PDT)
In-Reply-To: <1e3daa7c-e10a-4589-8118-26f47bc1a0df@isocpp.org>
X-Original-Sender: gregmmarr@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:26216
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26216>

------=_Part_649_1412130046.1465398681382
Content-Type: multipart/alternative; 
	boundary="----=_Part_650_1948991266.1465398681383"

------=_Part_650_1948991266.1465398681383
Content-Type: text/plain; charset=UTF-8

On Wednesday, June 8, 2016 at 10:14:50 AM UTC-4, Sergey Vidyuk wrote:
>
> Expression folding on a variadic template parameters pack are great and 
> allows to write internal function stuff inside a function instead of 
> writing some recursive template code which is required to be moved outside 
> of the function. But when one want to repeat some statement for every 
> element of a parameter pack recursive templates or abusing of coma operator 
> folding are stil the only options. After facing this issue several times I 
> start to realize that it would be great to have the following extension to 
> the C++11 range-for syntax:
>

Have you seen Sean Parent's for_each_argument?

template <class F, class... Args>
void for_each_argument(F f, Args&&... args) {
 [](...){}((f(std::forward<Args>(args)), 0)...);
}



There was even a CppCon 2015 talk about it 

https://www.youtube.com/watch?v=2l83JlqkzBk

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0aa49f06-08b0-433a-a897-720140eb7097%40isocpp.org.

------=_Part_650_1948991266.1465398681383
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, June 8, 2016 at 10:14:50 AM UTC-4, Sergey Vi=
dyuk wrote:<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">Ex=
pression folding on a variadic template parameters pack are great and allow=
s to write internal function stuff inside a function instead of writing som=
e recursive template code which is required to be moved outside of the func=
tion. But when one want to repeat some statement for every element of a par=
ameter pack recursive templates or abusing of coma operator folding are sti=
l the only options. After facing this issue several times I start to realiz=
e that it would be great to have the following extension to the C++11 range=
-for syntax:<br></div></blockquote><div><br></div><div>Have you seen Sean P=
arent&#39;s for_each_argument?</div><div><br></div><div class=3D"prettyprin=
t" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; ba=
ckground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> F</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">class</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Args</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> for_each_argum=
ent</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">F f</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Args</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&amp;&amp;...</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> args</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">[=
](...){}((</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
f</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">forward</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Args</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">args</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">)),</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify=
">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)...);<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span></div></cod=
e></div><div><br><font color=3D"#595959" face=3D"Consolas, Courier New, Luc=
ida Console, monospace"><span style=3D"font-size: 12px; white-space: pre;">=
<br></span></font></div><div><font color=3D"#595959" face=3D"arial, sans-se=
rif"><span style=3D"font-size: 12px; white-space: pre;">There was even a Cp=
pCon 2015 talk about it </span></font></div><div><font color=3D"#595959" fa=
ce=3D"arial, sans-serif"><span style=3D"font-size: 12px; white-space: pre;"=
><br></span></font></div><div><font color=3D"#595959" face=3D"arial, sans-s=
erif"><span style=3D"font-size: 12px; white-space: pre;">https://www.youtub=
e.com/watch?v=3D2l83JlqkzBk</span><br></font></div><div><font color=3D"#595=
959" face=3D"arial, sans-serif"><span style=3D"font-size: 12px; white-space=
: pre;"><br></span></font></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0aa49f06-08b0-433a-a897-720140eb7097%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0aa49f06-08b0-433a-a897-720140eb7097=
%40isocpp.org</a>.<br />

------=_Part_650_1948991266.1465398681383--

------=_Part_649_1412130046.1465398681382--

.
