220 31511 <dd6502e6-274b-4de4-b31f-1fe9783456eb@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Enhanced fold expressions
Date: Wed, 8 Mar 2017 14:58:17 -0800 (PST)
Lines: 303
Approved: news@gmane.org
Message-ID: <dd6502e6-274b-4de4-b31f-1fe9783456eb@isocpp.org>
References: <c2b847b0-dd26-4d79-aad7-8c808008c0a4@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2273_1087352596.1489013897864"
X-Trace: blaine.gmane.org 1489013905 23691 195.159.176.226 (8 Mar 2017 22:58:25 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 8 Mar 2017 22:58:25 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLZJYWNDQIIVGMCYYCRUBEKIVTFQ@isocpp.org Wed Mar 08 23:58:16 2017
Return-path: <std-proposals+bncBDLZJYWNDQIIVGMCYYCRUBEKIVTFQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f200.google.com ([209.85.220.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDLZJYWNDQIIVGMCYYCRUBEKIVTFQ@isocpp.org>)
	id 1clkX7-00056V-Ou
	for gclcip-std-proposals@m.gmane.org; Wed, 08 Mar 2017 23:58:14 +0100
Original-Received: by mail-qk0-f200.google.com with SMTP id n141sf111953483qke.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 08 Mar 2017 14:58:20 -0800 (PST)
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=+INumRQkM44TUWKk38unlkSelsxvksEoUlzD4syK1gA=;
        b=Uj2S/pvUO7ef0uZ+30w4SMtKLDWtgqjtgi1yesR7q4Bx/A1cjOZ0PS8lescWqQ71hC
         led4BYb8+OiFT2yfXMLlZuEP2XWDBKqaweldqcln1mkLPSp1wsbqyITWgqUbcHzUmjRs
         XMQ6Llzk3lZod/XFSJ6kEM2CbZXfvAd7Uapsb+DNJBKtOgiAN1/gfpcg4VjASmQDT7UY
         FCl1M9lUqyDOlVY9VuRDlKYRFxVFe03772kxBVc+XeOUcSH4CbEjKRNetVZwZd9vc39C
         XP0Z4PpJNTUSe3FxxlQPc+AD6gpV6O1g/VoRFApeQI/hV3HZxB3fKQNe3l2rqKlhOChJ
         mO9g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        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=+INumRQkM44TUWKk38unlkSelsxvksEoUlzD4syK1gA=;
        b=h0tH1Tr4Yc3oZQ79kIxTui/P3YJ3vGOe1cRUkiFLq8yXyKy6piABHNsEFAbIYWItYV
         TEmxLj5JnWvGZ+sfoEqa0edD/zDh7HxT3Q18s1Glcsv9kEwyJ6Y7FVcKCjgdKX36My2M
         AW/jjSWf6RYxkakv+xnHMnhk7VvMMaPWb5sYp9lfxR3IidOvgCXWAExNhaoltpWirCZA
         N/1rPUHU2Z1Mq+n8B9xrI9TdrIK3rQpOdpGF8V62c3v1hMu+iikm2uMq8oeUctJBT3uB
         OENAjOUh9Myl22pF0tq/XeC1A2R8uDnNFx2oQ9EHatBDnqc7LyWwbmaL3o7DzE49cjia
         LJBQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        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=+INumRQkM44TUWKk38unlkSelsxvksEoUlzD4syK1gA=;
        b=lN714+FcqMgWiiZTHYrZw0X/OoIvTKkyCQ1LBccHUNvFkuN0umDtOJRt9uKrRw2QSU
         6wyPyUYQpdWrQe26db3H0D9pTNMghcZR3T1neJdPpaOCJvowM+C8GJRFjCueealk6wr/
         UedB6L+vLUX1SzMKQph1HQMrPGZ5RSmE9WZKCSGbHOq3c6BoFs1GQqDQVEi5lNOecc/e
         5ZiHzWvcb+0P9Ze1tlQq/5sQoMThTin1pC2tcdkzq5xc/DPsuytjzMf8usuyzrKhtlDq
         CTY5QHfMUEIbuQuTC1Nsi78Dl9vcFkKAkbOY4lmfvdvMcN762HA0sR3N9WniLzVUbkb7
         cKrA==
X-Gm-Message-State: AMke39lFw361osScEDlYHFstSqkG/CU54XdN/vGniUyFh9R9Tsd3YUpLpEVY264kitPSWA==
X-Received: by 10.129.71.9 with SMTP id u9mr3727440ywa.142.1489013899539;
        Wed, 08 Mar 2017 14:58:19 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.47.173 with SMTP id r42ls443401otb.26.gmail; Wed, 08 Mar
 2017 14:58:18 -0800 (PST)
X-Received: by 10.157.32.3 with SMTP id n3mr1324541ota.1.1489013898679;
        Wed, 08 Mar 2017 14:58:18 -0800 (PST)
In-Reply-To: <c2b847b0-dd26-4d79-aad7-8c808008c0a4@isocpp.org>
X-Original-Sender: arthur.j.odwyer@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: <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:31511
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31511>

------=_Part_2273_1087352596.1489013897864
Content-Type: multipart/alternative; 
	boundary="----=_Part_2274_525504152.1489013897865"

------=_Part_2274_525504152.1489013897865
Content-Type: text/plain; charset=UTF-8

On Wednesday, March 8, 2017 at 11:11:27 AM UTC-8, Roman Orlov wrote:
[TLDR: folding over arbitrary binary functions] 
>
> I suggest to extend the meaning of binary operator in fold expression. *Operator 
> is a function*, so any *constexpr binary function* could be used in fold 
> expression.
> I've invented a little hack to proof the idea
>

(Minor point: constexpr is completely irrelevant to your use-case. You 
should drop the mention of a constexpr requirement.)

This hack is not new. See e.g.
https://ngathanasiou.wordpress.com/2015/12/15/182/
http://stackoverflow.com/a/42587567/1424877
 

> template<typename T, T... Args>
> constexpr T min(std::integer_sequence<T, Args...>)
> {
>     return (... << dummy_int(Args)); // explicitly convert to dummy_int
> }
>

Using my version <http://stackoverflow.com/a/42587567/1424877> of the hack, 
you would write

template<typename T, T... Args>
constexpr T max(std::integer_sequence<T, Args...>)
{
    auto mmax = make_named_operator([](auto&& a, auto&& b){ return std::max(
a,b); });
    return (... + mmax(Args)); 
}

Nick Athanasiou's original blog post takes the more functional-programming 
approach: that what you should really write is

    return foldl([](auto&& a, auto&& b){ return std::max(a,b); }, Args...);


The code would be simpler if I can write it like this
>
> template<typename T, T... Args>
> constexpr T max(std::integer_sequence<T, Args...>)
> {
>     return (... std::max Args); 
> }
>

Agreed that that might look simpler (and you could add a code comment with 
that syntax if you think it'd help the reader); but I don't see how you 
expect the compiler to figure out what you mean by that syntax, 
unambiguously. For example, what is

    return (... std::max (Args));
    return (... std::max<int> Args);
    return (... func_ptr Args);
    return (... (*func_ptr) Args);
    return (... func_ptr*Args);
    return (... (*Args) Args);

Any time you take a piece of the grammar that currently accepts a closed 
set of operators and propose changing it to accept an open set of 
expressions, that's a red flag; or at least an indication that you need to 
think really hard about whether there might be any corner cases.

FYI, Barry Revzin's P0573R0 
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0573r0.html> 
(which I am generally against) mentions (but does not propose) the syntax 
[]std::max as a shortcut way of writing [](auto&&... args) -> 
decltype(auto) { return std::max(args...); }. If we had that, not only 
would the two alternatives presented above get a lot shorter, but you 
wouldn't have to worry quite so much about the fact that the identifier 
std::max by itself doesn't denote any particular *entity* (but rather just 
an overload set of a bunch of otherwise unrelated entities). You could 
design your syntax to work cleanly with []foo by design.

my $.02,
Arthur

-- 
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/dd6502e6-274b-4de4-b31f-1fe9783456eb%40isocpp.org.

------=_Part_2274_525504152.1489013897865
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, March 8, 2017 at 11:11:27 AM UTC-8, Roman Or=
lov wrote:<div>[TLDR: folding over arbitrary binary functions]=C2=A0<blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>I suggest to ex=
tend the meaning of binary operator in fold expression. <b>Operator is a fu=
nction</b>, so any <b>constexpr binary function</b> could be used in fold e=
xpression.</div><div>I&#39;ve invented a little hack to proof the idea</div=
></div></blockquote><div><br></div><div>(Minor point: constexpr is complete=
ly irrelevant to your use-case. You should drop the mention of a constexpr =
requirement.)</div><div><br></div><div>This hack is not new. See e.g.</div>=
<div><a href=3D"https://ngathanasiou.wordpress.com/2015/12/15/182/">https:/=
/ngathanasiou.wordpress.com/2015/12/15/182/</a><br></div><div><a href=3D"ht=
tp://stackoverflow.com/a/42587567/1424877">http://stackoverflow.com/a/42587=
567/1424877</a><br></div><div>=C2=A0<br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padd=
ing-left: 1ex;"><div dir=3D"ltr"><div style=3D"background-color:rgb(250,250=
,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;wor=
d-wrap:break-word"><code><div><span style=3D"color:#008">template</span><sp=
an style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</spa=
n><span style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"> T</span><span style=3D"color:#660">...</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#606">Args</span><span =
style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><span=
 style=3D"color:#008">constexpr</span><span style=3D"color:#000"> T min</sp=
an><span style=3D"color:#660">(</span><span style=3D"color:#000">std</span>=
<span style=3D"color:#660">::</span><span style=3D"color:#000">integer_sequ=
ence</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000"=
>T</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#606">Args</span><span style=3D"color:#660">...&gt=
;)</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">{=
</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"c=
olor:#008">return</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">(...</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">&lt;&lt;</span><span style=3D"color:#000"> dummy_int</span><span s=
tyle=3D"color:#660">(</span><span style=3D"color:#606">Args</span><span sty=
le=3D"color:#660">));</span><span style=3D"color:#000"> </span><span style=
=3D"color:#800">// explicitly convert to dummy_int</span><span style=3D"col=
or:#000"><br></span><span style=3D"color:#660">}</span></div></code></div><=
/div></blockquote><div><br></div><div>Using <a href=3D"http://stackoverflow=
..com/a/42587567/1424877">my version</a> of the hack, you would write</div><=
div><br></div><div><div class=3D"prettyprint" style=3D"background-color: rg=
b(250, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: break-wo=
rd;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Args</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> T max</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 style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">integer_sequence</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Args</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&g=
t;)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> mmax </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> make_named_operator</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">([](</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">auto</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> b</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span><s=
pan 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">max</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">a</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">b</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: #660;" class=3D"styled-by-prettify">});</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">return</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(...</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">+</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> mmax</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(</span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Args</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">));</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <b=
r></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div>=
</code></div><div><br></div></div><div>Nick Athanasiou&#39;s original blog =
post takes the more functional-programming approach: that what you should r=
eally write is<br></div><div><br></div><div><div class=3D"prettyprint" styl=
e=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb(187, 187, =
187); word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"sub=
prettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>return</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> fo=
ldl</span><span style=3D"color: #660;" class=3D"styled-by-prettify">([](</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> a</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">auto</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">){</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">r=
eturn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">max</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">a</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">b</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">},=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">...);</span></div></code>=
</div><br></div><div><br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"=
><div dir=3D"ltr"><div>The code would be simpler if I can write it like thi=
s</div><div><br></div><div style=3D"background-color:rgb(250,250,250);borde=
r-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:brea=
k-word"><code><div><span style=3D"color:#008">template</span><span style=3D=
"color:#660">&lt;</span><span style=3D"color:#008">typename</span><span sty=
le=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> T</span><span style=3D"color:#660">...</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Args</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">constexpr</span><span style=3D"color:#000"> T max</span><s=
pan style=3D"color:#660">(</span><span style=3D"color:#000">std</span><span=
 style=3D"color:#660">::</span><span style=3D"color:#000">integer_sequence<=
/span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">T</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><=
span style=3D"color:#606">Args</span><span style=3D"color:#660">...&gt;)</s=
pan><span style=3D"color:#000"><br></span><span style=3D"color:#660">{</spa=
n><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:=
#008">return</span><span style=3D"color:#000"> </span><span style=3D"color:=
#660">(...</span><span style=3D"color:#000"> std</span><span style=3D"color=
:#660">::</span><span style=3D"color:#000">max </span><span style=3D"color:=
#606">Args</span><span style=3D"color:#660">);</span><span style=3D"color:#=
000"> <br></span><span style=3D"color:#660">}</span></div></code></div></di=
v></blockquote><div><br></div><div>Agreed that that might look simpler (and=
 you could add a code comment with that syntax if you think it&#39;d help t=
he reader); but I don&#39;t see how you expect the compiler to figure out w=
hat you mean by that syntax, unambiguously. For example, what is</div></div=
><div><br></div><div>=C2=A0 =C2=A0 return (... std::max (Args));</div><div>=
=C2=A0 =C2=A0 return (... std::max&lt;int&gt; Args);</div><div>=C2=A0 =C2=
=A0 return (... func_ptr Args);</div><div>=C2=A0 =C2=A0 return (... (*func_=
ptr) Args);<br></div><div><div>=C2=A0 =C2=A0 return (... func_ptr*Args);</d=
iv><div>=C2=A0 =C2=A0 return (... (*Args) Args);<br></div></div><div><br></=
div><div>Any time you take a piece of the grammar that currently accepts a =
closed set of operators and propose changing it to accept an open set of ex=
pressions, that&#39;s a red flag; or at least an indication that you need t=
o think really hard about whether there might be any corner cases.</div><di=
v><br></div><div>FYI, Barry Revzin&#39;s <a href=3D"http://www.open-std.org=
/jtc1/sc22/wg21/docs/papers/2017/p0573r0.html">P0573R0</a> (which I am gene=
rally against) mentions (but does not propose) the syntax <font face=3D"cou=
rier new, monospace">[]std::max</font> as a shortcut way of writing <font f=
ace=3D"courier new, monospace">[](auto&amp;&amp;... args) -&gt; decltype(au=
to) { return std::max(args...); }</font>. If we had that, not only would th=
e two alternatives presented above get a lot shorter, but you wouldn&#39;t =
have to worry quite so much about the fact that the identifier <font face=
=3D"courier new, monospace">std::max</font> by itself doesn&#39;t denote an=
y particular <i>entity</i>=C2=A0(but rather just an overload set of a bunch=
 of otherwise unrelated entities). You could design your syntax to work cle=
anly with <font face=3D"courier new, monospace">[]foo</font> by design.</di=
v><div><br></div><div>my $.02,</div><div>Arthur</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/dd6502e6-274b-4de4-b31f-1fe9783456eb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/dd6502e6-274b-4de4-b31f-1fe9783456eb=
%40isocpp.org</a>.<br />

------=_Part_2274_525504152.1489013897865--

------=_Part_2273_1087352596.1489013897864--

.
