Topic: Static semantic well-formedness check


Author: Chris Gary <cgary512@gmail.com>
Date: Thu, 12 Feb 2015 22:59:39 -0800 (PST)
Raw View
------=_Part_14_993125253.1423810779784
Content-Type: multipart/alternative;
 boundary="----=_Part_15_1213222687.1423810779784"

------=_Part_15_1213222687.1423810779784
Content-Type: text/plain; charset=UTF-8


Just entertaining a random idea: How about a well_formed operator?

template<typename CallableType, typename ...ArgTypes>
auto example(CallableType &&callable, ArgTypes &&...args)
-> typename enable_if<
        // Evaluates to 'true' if "callable(args...)" is well-formed,
        // or 'false' if it is not.
        well_formed( forward<CallableType>(callable)(forward<ArgTypes>(args
)...) ),
        any
    >::type
{
    // do things!
}


That is, well-formedness in the semantic sense. Syntax errors should still
prevent compilation, obviously.

This would eliminate the need for a dedicated "can_XXX" or "has_XXX"
predicate based on the sizeof() trick.

Thoughts?

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_15_1213222687.1423810779784
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br>Just entertaining a random idea: How about a <span sty=
le=3D"font-family: courier new,monospace;">well_formed<font face=3D"arial,s=
ans-serif"> operator?<br><br><div class=3D"prettyprint" style=3D"background=
-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style:=
 solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettypri=
nt"><div class=3D"subprettyprint"><span style=3D"font-family: courier new,m=
onospace;"><font face=3D"arial,sans-serif"><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; word-wrap: break-word;"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><font face=3D"arial,sans-se=
rif"><span style=3D"font-family: courier new,monospace;"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">template</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">CallableType</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">ArgTypes</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> example</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">CallableType</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">callable</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">ArgTypes</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;=
&amp;...</span><span style=3D"color: #000;" class=3D"styled-by-prettify">ar=
gs</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">-&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> enable_if</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">// Evaluates to 'true' =
if "callable(args...)" is well-formed,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">// or 'false' if it is no=
t.</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; &nbsp; &nbsp; &nbsp; well_formed</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> forward</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">&lt;</span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">CallableType</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">callable</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">forwa=
rd</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">ArgTypes</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">args</span><span styl=
e=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=
60;" class=3D"styled-by-prettify">),</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nbsp; any<br>&nbsp; &nb=
sp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">type<br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">// do things!=
</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><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></font>=
</div></code></div></font></span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"></span></div></code></div><br><br>That is, well-formedness =
in the semantic sense. Syntax errors should still prevent compilation, obvi=
ously.<br><br>This would eliminate the need for a dedicated "<span style=3D=
"font-family: courier new,monospace;">can_XXX</span>" or "<span style=3D"fo=
nt-family: courier new,monospace;">has_XXX</span>" predicate based on the <=
span style=3D"font-family: courier new,monospace;">sizeof()</span> trick.<b=
r><br>Thoughts?<br></font></span></div>

<p></p>

-- <br />
<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 <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 />
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_15_1213222687.1423810779784--
------=_Part_14_993125253.1423810779784--

.


Author: "T. C." <rs2740@gmail.com>
Date: Thu, 12 Feb 2015 23:28:08 -0800 (PST)
Raw View
------=_Part_8039_319714683.1423812489031
Content-Type: multipart/alternative;
 boundary="----=_Part_8040_440592387.1423812489032"

------=_Part_8040_440592387.1423812489032
Content-Type: text/plain; charset=UTF-8

Given template<class T> T declprval(); , this can already be done with

-> decltype(forward<CallableType>(callable)(forward<ArgTypes>(args)...) ),
void(), declprval<any>())

No dedicated predicate necessary.

On Friday, February 13, 2015 at 2:59:40 PM UTC+8, Chris Gary wrote:
>
>
> Just entertaining a random idea: How about a well_formed operator?
>
> template<typename CallableType, typename ...ArgTypes>
> auto example(CallableType &&callable, ArgTypes &&...args)
> -> typename enable_if<
>         // Evaluates to 'true' if "callable(args...)" is well-formed,
>         // or 'false' if it is not.
>         well_formed( forward<CallableType>(callable)(forward<ArgTypes>(
> args)...) ),
>         any
>     >::type
> {
>     // do things!
> }
>
>
> That is, well-formedness in the semantic sense. Syntax errors should still
> prevent compilation, obviously.
>
> This would eliminate the need for a dedicated "can_XXX" or "has_XXX"
> predicate based on the sizeof() trick.
>
> Thoughts?
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_8040_440592387.1423812489032
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Given <font face=3D"courier new, monospace">template&=
lt;class T&gt; T declprval();</font>&nbsp;, this can already be done with<b=
r></div><div><br></div><div><span style=3D"font-family: 'courier new', mono=
space; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">-&gt=
;</span><span style=3D"font-family: 'courier new', monospace; color: rgb(0,=
 0, 0); background-color: rgb(250, 250, 250);">&nbsp;</span><span style=3D"=
font-family: 'courier new', monospace; background-color: rgb(250, 250, 250)=
;"><font color=3D"#000088">decltype(</font></span><span style=3D"font-famil=
y: 'courier new', monospace; color: rgb(0, 0, 0); background-color: rgb(250=
, 250, 250);">forward</span><span style=3D"font-family: 'courier new', mono=
space; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">&lt;=
</span><span style=3D"font-family: 'courier new', monospace; color: rgb(102=
, 0, 102); background-color: rgb(250, 250, 250);">CallableType</span><span =
style=3D"font-family: 'courier new', monospace; color: rgb(102, 102, 0); ba=
ckground-color: rgb(250, 250, 250);">&gt;(</span><span style=3D"font-family=
: 'courier new', monospace; color: rgb(0, 0, 0); background-color: rgb(250,=
 250, 250);">callable</span><span style=3D"font-family: 'courier new', mono=
space; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"><wbr=
>)(</span><span style=3D"font-family: 'courier new', monospace; color: rgb(=
0, 0, 0); background-color: rgb(250, 250, 250);">forward</span><span style=
=3D"font-family: 'courier new', monospace; color: rgb(102, 102, 0); backgro=
und-color: rgb(250, 250, 250);">&lt;</span><span style=3D"font-family: 'cou=
rier new', monospace; color: rgb(102, 0, 102); background-color: rgb(250, 2=
50, 250);">ArgTypes</span><span style=3D"font-family: 'courier new', monosp=
ace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">&gt;(<=
/span><span style=3D"font-family: 'courier new', monospace; color: rgb(0, 0=
, 0); background-color: rgb(250, 250, 250);">args</span><span style=3D"font=
-family: 'courier new', monospace; color: rgb(102, 102, 0); background-colo=
r: rgb(250, 250, 250);">)...)</span><span style=3D"font-family: 'courier ne=
w', monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">=
&nbsp;</span><span style=3D"font-family: 'courier new', monospace; color: r=
gb(102, 102, 0); background-color: rgb(250, 250, 250);">), void(), declprva=
l&lt;any&gt;())</span><br></div><div><br></div><div>No dedicated predicate =
necessary.</div><div><br></div><div><div>On Friday, February 13, 2015 at 2:=
59:40 PM UTC+8, Chris Gary 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"><br>Just entertaining a random idea: How about a <span =
style=3D"font-family:courier new,monospace">well_formed<font face=3D"arial,=
sans-serif"> operator?<br><br><div style=3D"background-color:rgb(250,250,25=
0);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-w=
rap:break-word"><code><div><span style=3D"font-family:courier new,monospace=
"><font face=3D"arial,sans-serif"><div style=3D"background-color:rgb(250,25=
0,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;wo=
rd-wrap:break-word"><code><div><font face=3D"arial,sans-serif"><span style=
=3D"font-family:courier new,monospace"><span style=3D"color:#008">template<=
/span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">type=
name</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Ca=
llableType</span><span style=3D"color:#660">,</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#008">typename</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">...</span><span style=3D"color:#60=
6">ArgTypes</span><span style=3D"color:#660">&gt;</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#008">auto</span><span style=3D"col=
or:#000"> example</span><span style=3D"color:#660">(</span><span style=3D"c=
olor:#606">CallableType</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000">callable</span=
><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#606">ArgTypes</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660">&amp;&amp;...</span><span style=3D"color:#000">arg=
s</span><span style=3D"color:#660">)</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#660">-&gt;</span><span style=3D"color:#000"> </=
span><span style=3D"color:#008">typename</span><span style=3D"color:#000"> =
enable_if</span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"color:#800">// =
Evaluates to 'true' if "callable(args...)" is well-formed,</span><span styl=
e=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"colo=
r:#800">// or 'false' if it is not.</span><span style=3D"color:#000"><br>&n=
bsp; &nbsp; &nbsp; &nbsp; well_formed</span><span style=3D"color:#660">(</s=
pan><span style=3D"color:#000"> forward</span><span style=3D"color:#660">&l=
t;</span><span style=3D"color:#606">CallableType</span><span style=3D"color=
:#660">&gt;(</span><span style=3D"color:#000">callable</span><span style=3D=
"color:#660"><wbr>)(</span><span style=3D"color:#000">forward</span><span s=
tyle=3D"color:#660">&lt;</span><span style=3D"color:#606">ArgTypes</span><s=
pan style=3D"color:#660">&gt;(</span><span style=3D"color:#000">args</span>=
<span style=3D"color:#660">)...)</span><span style=3D"color:#000"> </span><=
span style=3D"color:#660">),</span><span style=3D"color:#000"><br>&nbsp; &n=
bsp; &nbsp; &nbsp; any<br>&nbsp; &nbsp; </span><span style=3D"color:#660">&=
gt;::</span><span style=3D"color:#000">type<br></span><span style=3D"color:=
#660">{</span><span style=3D"color:#000"><br>&nbsp; &nbsp; </span><span sty=
le=3D"color:#800">// do things!</span><span style=3D"color:#000"><br></span=
><span style=3D"color:#660">}</span></span><span style=3D"color:#000"><br><=
/span></font></div></code></div></font></span><span style=3D"color:#660"></=
span></div></code></div><br><br>That is, well-formedness in the semantic se=
nse. Syntax errors should still prevent compilation, obviously.<br><br>This=
 would eliminate the need for a dedicated "<span style=3D"font-family:couri=
er new,monospace">can_XXX</span>" or "<span style=3D"font-family:courier ne=
w,monospace">has_XXX</span>" predicate based on the <span style=3D"font-fam=
ily:courier new,monospace">sizeof()</span> trick.<br><br>Thoughts?<br></fon=
t></span></div></blockquote></div></div></div>

<p></p>

-- <br />
<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 <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 />
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_8040_440592387.1423812489032--
------=_Part_8039_319714683.1423812489031--

.


Author: "T. C." <rs2740@gmail.com>
Date: Thu, 12 Feb 2015 23:29:15 -0800 (PST)
Raw View
------=_Part_8701_1667088215.1423812555420
Content-Type: multipart/alternative;
 boundary="----=_Part_8702_532487096.1423812555420"

------=_Part_8702_532487096.1423812555420
Content-Type: text/plain; charset=UTF-8


There's a stray ) before the first comma. I meant

-> decltype(forward<CallableType>(callable)(forward<ArgTypes>(args)...),
void(), declprval<any>())

On Friday, February 13, 2015 at 3:28:09 PM UTC+8, T. C. wrote:
>
> Given template<class T> T declprval(); , this can already be done with
>
> -> decltype(forward<CallableType>(callable)(forward<ArgTypes>(args)...) ),
> void(), declprval<any>())
>
> No dedicated predicate necessary.
>
> On Friday, February 13, 2015 at 2:59:40 PM UTC+8, Chris Gary wrote:
>>
>>
>> Just entertaining a random idea: How about a well_formed operator?
>>
>> template<typename CallableType, typename ...ArgTypes>
>> auto example(CallableType &&callable, ArgTypes &&...args)
>> -> typename enable_if<
>>         // Evaluates to 'true' if "callable(args...)" is well-formed,
>>         // or 'false' if it is not.
>>         well_formed( forward<CallableType>(callable)(forward<ArgTypes>(
>> args)...) ),
>>         any
>>     >::type
>> {
>>     // do things!
>> }
>>
>>
>> That is, well-formedness in the semantic sense. Syntax errors should
>> still prevent compilation, obviously.
>>
>> This would eliminate the need for a dedicated "can_XXX" or "has_XXX"
>> predicate based on the sizeof() trick.
>>
>> Thoughts?
>>
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_8702_532487096.1423812555420
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br>There's a stray ) before the first comma. I meant&nbsp=
;<div><br></div><div><span style=3D"font-family: 'courier new', monospace; =
color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">-&gt;</span=
><span style=3D"font-family: 'courier new', monospace; color: rgb(0, 0, 0);=
 background-color: rgb(250, 250, 250);">&nbsp;</span><span style=3D"font-fa=
mily: 'courier new', monospace; background-color: rgb(250, 250, 250);"><fon=
t color=3D"#000088">decltype(</font></span><span style=3D"font-family: 'cou=
rier new', monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, =
250);">forward</span><span style=3D"font-family: 'courier new', monospace; =
color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">&lt;</span>=
<span style=3D"font-family: 'courier new', monospace; color: rgb(102, 0, 10=
2); background-color: rgb(250, 250, 250);">CallableTy<wbr>pe</span><span st=
yle=3D"font-family: 'courier new', monospace; color: rgb(102, 102, 0); back=
ground-color: rgb(250, 250, 250);">&gt;(</span><span style=3D"font-family: =
'courier new', monospace; color: rgb(0, 0, 0); background-color: rgb(250, 2=
50, 250);">callable</span><span style=3D"font-family: 'courier new', monosp=
ace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">)(</sp=
an><span style=3D"font-family: 'courier new', monospace; color: rgb(0, 0, 0=
); background-color: rgb(250, 250, 250);">forward</span><span style=3D"font=
-family: 'courier new', monospace; color: rgb(102, 102, 0); background-colo=
r: rgb(250, 250, 250);">&lt;</span><span style=3D"font-family: 'courier new=
', monospace; color: rgb(102, 0, 102); background-color: rgb(250, 250, 250)=
;">ArgTypes</span><span style=3D"font-family: 'courier new', monospace; col=
or: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"><wbr>&gt;(</sp=
an><span style=3D"font-family: 'courier new', monospace; color: rgb(0, 0, 0=
); background-color: rgb(250, 250, 250);">args</span><span style=3D"font-fa=
mily: 'courier new', monospace; color: rgb(102, 102, 0); background-color: =
rgb(250, 250, 250);">)...)</span><span style=3D"font-family: 'courier new',=
 monospace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);"=
>, void(), declprval&lt;any&gt;())</span></div><div><font color=3D"#666600"=
 face=3D"courier new, monospace"><br></font>On Friday, February 13, 2015 at=
 3:28:09 PM UTC+8, T. C. wrote:<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>Given <font face=3D"courier new, monospace">template=
&lt;class T&gt; T declprval();</font>&nbsp;, this can already be done with<=
br></div><div><br></div><div><span style=3D"font-family:'courier new',monos=
pace;color:rgb(102,102,0);background-color:rgb(250,250,250)">-&gt;</span><s=
pan style=3D"font-family:'courier new',monospace;color:rgb(0,0,0);backgroun=
d-color:rgb(250,250,250)">&nbsp;</span><span style=3D"font-family:'courier =
new',monospace;background-color:rgb(250,250,250)"><font color=3D"#000088">d=
ecltype(</font></span><span style=3D"font-family:'courier new',monospace;co=
lor:rgb(0,0,0);background-color:rgb(250,250,250)">forward</span><span style=
=3D"font-family:'courier new',monospace;color:rgb(102,102,0);background-col=
or:rgb(250,250,250)">&lt;</span><span style=3D"font-family:'courier new',mo=
nospace;color:rgb(102,0,102);background-color:rgb(250,250,250)">CallableTy<=
wbr>pe</span><span style=3D"font-family:'courier new',monospace;color:rgb(1=
02,102,0);background-color:rgb(250,250,250)">&gt;(</span><span style=3D"fon=
t-family:'courier new',monospace;color:rgb(0,0,0);background-color:rgb(250,=
250,250)">callable</span><span style=3D"font-family:'courier new',monospace=
;color:rgb(102,102,0);background-color:rgb(250,250,250)">)(</span><span sty=
le=3D"font-family:'courier new',monospace;color:rgb(0,0,0);background-color=
:rgb(250,250,250)">forward</span><span style=3D"font-family:'courier new',m=
onospace;color:rgb(102,102,0);background-color:rgb(250,250,250)">&lt;</span=
><span style=3D"font-family:'courier new',monospace;color:rgb(102,0,102);ba=
ckground-color:rgb(250,250,250)">ArgTypes</span><span style=3D"font-family:=
'courier new',monospace;color:rgb(102,102,0);background-color:rgb(250,250,2=
50)"><wbr>&gt;(</span><span style=3D"font-family:'courier new',monospace;co=
lor:rgb(0,0,0);background-color:rgb(250,250,250)">args</span><span style=3D=
"font-family:'courier new',monospace;color:rgb(102,102,0);background-color:=
rgb(250,250,250)">)...)</span><span style=3D"font-family:'courier new',mono=
space;color:rgb(0,0,0);background-color:rgb(250,250,250)">&nbsp;</span><spa=
n style=3D"font-family:'courier new',monospace;color:rgb(102,102,0);backgro=
und-color:rgb(250,250,250)">), void(), declprval&lt;any&gt;())</span><br></=
div><div><br></div><div>No dedicated predicate necessary.</div><div><br></d=
iv><div><div>On Friday, February 13, 2015 at 2:59:40 PM UTC+8, Chris Gary w=
rote:<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>Just ente=
rtaining a random idea: How about a <span style=3D"font-family:courier new,=
monospace">well_formed<font face=3D"arial,sans-serif"> operator?<br><br><di=
v style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);=
border-style:solid;border-width:1px;word-wrap:break-word"><code><div><span =
style=3D"font-family:courier new,monospace"><font face=3D"arial,sans-serif"=
><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,1=
87);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><f=
ont face=3D"arial,sans-serif"><span style=3D"font-family:courier new,monosp=
ace"><span style=3D"color:#008">template</span><span style=3D"color:#660">&=
lt;</span><span style=3D"color:#008">typename</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#606">CallableType</span><span style=3D"co=
lor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">typename</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">...</span><span style=3D"color:#606">ArgTypes</span><span style=3D"c=
olor:#660">&gt;</span><span style=3D"color:#000"><br></span><span style=3D"=
color:#008">auto</span><span style=3D"color:#000"> example</span><span styl=
e=3D"color:#660">(</span><span style=3D"color:#606">CallableType</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660">&amp;&amp;</span>=
<span style=3D"color:#000">callable</span><span style=3D"color:#660">,</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#606">ArgTypes</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;&amp=
;...</span><span style=3D"color:#000">args</span><span style=3D"color:#660"=
>)</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">-=
&gt;</span><span style=3D"color:#000"> </span><span style=3D"color:#008">ty=
pename</span><span style=3D"color:#000"> enable_if</span><span style=3D"col=
or:#660">&lt;</span><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nb=
sp; </span><span style=3D"color:#800">// Evaluates to 'true' if "callable(a=
rgs...)" is well-formed,</span><span style=3D"color:#000"><br>&nbsp; &nbsp;=
 &nbsp; &nbsp; </span><span style=3D"color:#800">// or 'false' if it is not=
..</span><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; well_for=
med</span><span style=3D"color:#660">(</span><span style=3D"color:#000"> fo=
rward</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#606=
">CallableType</span><span style=3D"color:#660">&gt;(</span><span style=3D"=
color:#000">callable</span><span style=3D"color:#660"><wbr>)(</span><span s=
tyle=3D"color:#000">forward</span><span style=3D"color:#660">&lt;</span><sp=
an style=3D"color:#606">ArgTypes</span><span style=3D"color:#660">&gt;(</sp=
an><span style=3D"color:#000">args</span><span style=3D"color:#660">)...)</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">),</span=
><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; any<br>&nbsp; &=
nbsp; </span><span style=3D"color:#660">&gt;::</span><span style=3D"color:#=
000">type<br></span><span style=3D"color:#660">{</span><span style=3D"color=
:#000"><br>&nbsp; &nbsp; </span><span style=3D"color:#800">// do things!</s=
pan><span style=3D"color:#000"><br></span><span style=3D"color:#660">}</spa=
n></span><span style=3D"color:#000"><br></span></font></div></code></div></=
font></span><span style=3D"color:#660"></span></div></code></div><br><br>Th=
at is, well-formedness in the semantic sense. Syntax errors should still pr=
event compilation, obviously.<br><br>This would eliminate the need for a de=
dicated "<span style=3D"font-family:courier new,monospace">can_XXX</span>" =
or "<span style=3D"font-family:courier new,monospace">has_XXX</span>" predi=
cate based on the <span style=3D"font-family:courier new,monospace">sizeof(=
)</span> trick.<br><br>Thoughts?<br></font></span></div></blockquote></div>=
</div></div></blockquote></div></div>

<p></p>

-- <br />
<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 <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 />
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_8702_532487096.1423812555420--
------=_Part_8701_1667088215.1423812555420--

.


Author: Chris Gary <cgary512@gmail.com>
Date: Thu, 12 Feb 2015 23:30:30 -0800 (PST)
Raw View
------=_Part_242_1581342029.1423812630174
Content-Type: multipart/alternative;
 boundary="----=_Part_243_357866131.1423812630174"

------=_Part_243_357866131.1423812630174
Content-Type: text/plain; charset=UTF-8

Derp.

N3351, p.56 addresses this specific example, though a generic "won't raise
a compilation error" predicate would be nice.

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_243_357866131.1423812630174
Content-Type: text/html; charset=UTF-8

<div dir="ltr">Derp.<br><br>N3351, p.56 addresses this specific example, though a generic "won't raise a compilation error" predicate would be nice.<br></div>

<p></p>

-- <br />
<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 email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

------=_Part_243_357866131.1423812630174--
------=_Part_242_1581342029.1423812630174--

.


Author: Chris Gary <cgary512@gmail.com>
Date: Thu, 12 Feb 2015 23:34:21 -0800 (PST)
Raw View
------=_Part_2697_111666139.1423812861544
Content-Type: multipart/alternative;
 boundary="----=_Part_2698_824058679.1423812861556"

------=_Part_2698_824058679.1423812861556
Content-Type: text/plain; charset=UTF-8

I'm too used to putting everything in an enable_if...

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_2698_824058679.1423812861556
Content-Type: text/html; charset=UTF-8

<div dir="ltr">I'm too used to putting everything in an <span style="font-family: courier new,monospace;">enable_if</span>...<br></div>

<p></p>

-- <br />
<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 email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

------=_Part_2698_824058679.1423812861556--
------=_Part_2697_111666139.1423812861544--

.


Author: Scott Prager <splinterofchaos@gmail.com>
Date: Fri, 13 Feb 2015 06:56:28 -0800 (PST)
Raw View
------=_Part_63_2117431938.1423839388239
Content-Type: multipart/alternative;
 boundary="----=_Part_64_1727067529.1423839388239"

------=_Part_64_1727067529.1423839388239
Content-Type: text/plain; charset=UTF-8



On Friday, February 13, 2015 at 1:59:40 AM UTC-5, Chris Gary wrote:
>
>
> Just entertaining a random idea: How about a well_formed operator?
>

Isn't that a goal of concepts? *(crosses fingers for C++17)*


>
> template<typename CallableType, typename ...ArgTypes>
> auto example(CallableType &&callable, ArgTypes &&...args)
> -> typename enable_if<
>         // Evaluates to 'true' if "callable(args...)" is well-formed,
>         // or 'false' if it is not.
>         well_formed( forward<CallableType>(callable)(forward<ArgTypes>(
> args)...) ),
>         any
>     >::type
> {
>     // do things!
> }
>
>
> That is, well-formedness in the semantic sense. Syntax errors should still
> prevent compilation, obviously.
>
> This would eliminate the need for a dedicated "can_XXX" or "has_XXX"
> predicate based on the sizeof() trick.
>
> Thoughts?
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_64_1727067529.1423839388239
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, February 13, 2015 at 1:59:40 AM UTC-5, =
Chris Gary wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><br>Just entertaining a random idea: How about a <span style=3D"font-fa=
mily:courier new,monospace">well_formed<font face=3D"arial,sans-serif"> ope=
rator?<br></font></span></div></blockquote><div><br></div><div>Isn't that a=
 goal of concepts? <i>(crosses fingers for C++17)</i></div><div>&nbsp;</div=
><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bo=
rder-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><span style=
=3D"font-family:courier new,monospace"><font face=3D"arial,sans-serif"><br>=
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"font-family:courier new,monospace"><font face=3D"arial,sans-ser=
if"><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,18=
7,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div=
><font face=3D"arial,sans-serif"><span style=3D"font-family:courier new,mon=
ospace"><span style=3D"color:#008">template</span><span style=3D"color:#660=
">&lt;</span><span style=3D"color:#008">typename</span><span style=3D"color=
:#000"> </span><span style=3D"color:#606">CallableType</span><span style=3D=
"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#008">typename</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#660">...</span><span style=3D"color:#606">ArgTypes</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">auto</span><span style=3D"color:#000"> example</span><span=
 style=3D"color:#660">(</span><span style=3D"color:#606">CallableType</span=
><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;&amp;</=
span><span style=3D"color:#000">callable</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#606">ArgTyp=
es</span><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp=
;&amp;...</span><span style=3D"color:#000">args</span><span style=3D"color:=
#660">)</span><span style=3D"color:#000"><br></span><span style=3D"color:#6=
60">-&gt;</span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">typename</span><span style=3D"color:#000"> enable_if</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#000"><br>&nbsp; &nbsp; &nb=
sp; &nbsp; </span><span style=3D"color:#800">// Evaluates to 'true' if "cal=
lable(args...)" is well-formed,</span><span style=3D"color:#000"><br>&nbsp;=
 &nbsp; &nbsp; &nbsp; </span><span style=3D"color:#800">// or 'false' if it=
 is not.</span><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; w=
ell_formed</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
00"> forward</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">CallableType</span><span style=3D"color:#660">&gt;(</span><span st=
yle=3D"color:#000">callable</span><span style=3D"color:#660"><wbr>)(</span>=
<span style=3D"color:#000">forward</span><span style=3D"color:#660">&lt;</s=
pan><span style=3D"color:#606">ArgTypes</span><span style=3D"color:#660">&g=
t;(</span><span style=3D"color:#000">args</span><span style=3D"color:#660">=
)...)</span><span style=3D"color:#000"> </span><span style=3D"color:#660">)=
,</span><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; any<br>&=
nbsp; &nbsp; </span><span style=3D"color:#660">&gt;::</span><span style=3D"=
color:#000">type<br></span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br>&nbsp; &nbsp; </span><span style=3D"color:#800">// do t=
hings!</span><span style=3D"color:#000"><br></span><span style=3D"color:#66=
0">}</span></span><span style=3D"color:#000"><br></span></font></div></code=
></div></font></span><span style=3D"color:#660"></span></div></code></div><=
br><br>That is, well-formedness in the semantic sense. Syntax errors should=
 still prevent compilation, obviously.<br><br>This would eliminate the need=
 for a dedicated "<span style=3D"font-family:courier new,monospace">can_XXX=
</span>" or "<span style=3D"font-family:courier new,monospace">has_XXX</spa=
n>" predicate based on the <span style=3D"font-family:courier new,monospace=
">sizeof()</span> trick.<br><br>Thoughts?<br></font></span></div></blockquo=
te></div>

<p></p>

-- <br />
<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 <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 />
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_64_1727067529.1423839388239--
------=_Part_63_2117431938.1423839388239--

.


Author: Casey Carter <cartec69@gmail.com>
Date: Fri, 13 Feb 2015 14:00:02 -0800 (PST)
Raw View
------=_Part_329_974861409.1423864802378
Content-Type: multipart/alternative;
 boundary="----=_Part_330_1342958100.1423864802378"

------=_Part_330_1342958100.1423864802378
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Friday, February 13, 2015 at 8:56:28 AM UTC-6, Scott Prager wrote:
>
> Isn't that a goal of concepts? *(crosses fingers for C++17)*
>

Translated directly into the syntax of N4377 Programming Languages =E2=80=
=94 C++=20
Extensions for Concepts=20
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4377.pdf>:

template <typename CallableType, typename ...ArgTypes>
  requires requires(CallableType callable, ArgTypes ...args) {
    forward<CallableType>(callable)(forward<ArgTypes>(args)...);
  }
any example(CallableType &&callable, ArgTypes &&...args)
{
    // do things!
}

Which is fairly ugly. I believe Andrew Sutton has admitted that he left the=
=20
"requires requires" wart in the syntax to encourage the use of named=20
concept declarations over ad-hoc inline requirement clauses . Consider the=
=20
more readable and reusable equivalent:

template <typename CallableType, typename ...ArgTypes>
concept bool Callable =3D requires(CallableType c, ArgTypes ...a) {
    forward<CallableType>(c)(forward<ArgTypes>(a)...);
};

Callable{F, ...Args}
any example(F &&callable, Args &&...args)
{
    // do things!
}

--=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_330_1342958100.1423864802378
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, February 13, 2015 at 8:56:28 AM UTC-6, Scott Pr=
ager 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"><d=
iv>Isn't that a goal of concepts? <i>(crosses fingers for C++17)</i></div><=
/div></blockquote><div><br></div><div>Translated directly into the syntax o=
f <a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4377.=
pdf">N4377 Programming Languages =E2=80=94 C++ Extensions for Concepts</a>:=
</div><div><br></div><div><div><span style=3D"font-family: 'courier new', m=
onospace; color: rgb(0, 0, 136); background-color: rgb(250, 250, 250);">tem=
plate &lt;typename CallableType, typename ...ArgTypes&gt;</span></div><div>=
<span style=3D"font-family: 'courier new', monospace; color: rgb(0, 0, 136)=
; background-color: rgb(250, 250, 250);">&nbsp; requires requires(CallableT=
ype callable, ArgTypes ...args) {</span></div><div><span style=3D"font-fami=
ly: 'courier new', monospace; color: rgb(0, 0, 136); background-color: rgb(=
250, 250, 250);">&nbsp; &nbsp; forward&lt;CallableType&gt;(callable)(forwar=
d&lt;ArgTypes&gt;(args)...);</span></div><div><span style=3D"font-family: '=
courier new', monospace; color: rgb(0, 0, 136); background-color: rgb(250, =
250, 250);">&nbsp; }</span></div><div><span style=3D"font-family: 'courier =
new', monospace; color: rgb(0, 0, 136); background-color: rgb(250, 250, 250=
);">any</span><span style=3D"font-family: 'courier new', monospace; color: =
rgb(0, 0, 0); background-color: rgb(250, 250, 250);">&nbsp;example</span><s=
pan style=3D"font-family: 'courier new', monospace; color: rgb(102, 102, 0)=
; background-color: rgb(250, 250, 250);">(</span><span style=3D"font-family=
: 'courier new', monospace; color: rgb(102, 0, 102); background-color: rgb(=
250, 250, 250);">CallableType</span><span style=3D"font-family: 'courier ne=
w', monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">=
&nbsp;</span><span style=3D"font-family: 'courier new', monospace; color: r=
gb(102, 102, 0); background-color: rgb(250, 250, 250);">&amp;&amp;</span><s=
pan style=3D"font-family: 'courier new', monospace; color: rgb(0, 0, 0); ba=
ckground-color: rgb(250, 250, 250);">callable</span><span style=3D"font-fam=
ily: 'courier new', monospace; color: rgb(102, 102, 0); background-color: r=
gb(250, 250, 250);">,</span><span style=3D"font-family: 'courier new', mono=
space; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">&nbsp;</=
span><span style=3D"font-family: 'courier new', monospace; color: rgb(102, =
0, 102); background-color: rgb(250, 250, 250);">ArgTypes</span><span style=
=3D"font-family: 'courier new', monospace; color: rgb(0, 0, 0); background-=
color: rgb(250, 250, 250);">&nbsp;</span><span style=3D"font-family: 'couri=
er new', monospace; color: rgb(102, 102, 0); background-color: rgb(250, 250=
, 250);">&amp;&amp;...</span><span style=3D"font-family: 'courier new', mon=
ospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">args</s=
pan><span style=3D"font-family: 'courier new', monospace; color: rgb(102, 1=
02, 0); background-color: rgb(250, 250, 250);">)</span></div><div><span sty=
le=3D"color: rgb(102, 102, 0); font-family: 'courier new', monospace; backg=
round-color: rgb(250, 250, 250);">{</span><br></div><div><span style=3D"fon=
t-family: 'courier new', monospace; color: rgb(0, 0, 0); background-color: =
rgb(250, 250, 250);">&nbsp; &nbsp;&nbsp;</span><span style=3D"font-family: =
'courier new', monospace; color: rgb(136, 0, 0); background-color: rgb(250,=
 250, 250);">// do things!</span><span style=3D"font-family: 'courier new',=
 monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);"><br=
></span><div><span style=3D"color: rgb(102, 102, 0); font-family: 'courier =
new', monospace; background-color: rgb(250, 250, 250);">}</span></div></div=
></div><div><br></div><div>Which is fairly ugly. I believe Andrew Sutton ha=
s admitted that he left the "requires requires" wart in the syntax to encou=
rage the use of named concept declarations over ad-hoc inline requirement c=
lauses . Consider the more readable and reusable equivalent:</div><div><br>=
</div><div><font face=3D"courier new, monospace">template &lt;typename Call=
ableType, typename ...ArgTypes&gt;</font></div><div><font face=3D"courier n=
ew, monospace">concept bool Callable =3D&nbsp;<span style=3D"color: rgb(0, =
0, 0); background-color: rgb(250, 250, 250);">requires(CallableType c, ArgT=
ypes ...a) {</span></font></div><div><span style=3D"color: rgb(0, 0, 0); ba=
ckground-color: rgb(250, 250, 250);"><font face=3D"courier new, monospace">=
&nbsp; &nbsp; forward&lt;CallableType&gt;(c)(forward&lt;ArgTypes&gt;(a)...)=
;</font></span></div><div><font face=3D"courier new, monospace"><span style=
=3D"color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">};</span><s=
pan style=3D"color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);"><b=
r></span></font></div><div><span style=3D"color: rgb(0, 0, 0); background-c=
olor: rgb(250, 250, 250);"><font face=3D"courier new, monospace"><br></font=
></span></div><div><span style=3D"color: rgb(0, 0, 136); background-color: =
rgb(250, 250, 250);"><font face=3D"courier new, monospace">Callable{F, ...A=
rgs}</font></span></div><div><font face=3D"courier new, monospace"><span st=
yle=3D"color: rgb(0, 0, 136); background-color: rgb(250, 250, 250);">any</s=
pan><span style=3D"color: rgb(0, 0, 0); background-color: rgb(250, 250, 250=
);">&nbsp;example</span><span style=3D"color: rgb(102, 102, 0); background-=
color: rgb(250, 250, 250);">(</span><span style=3D"color: rgb(0, 0, 0); bac=
kground-color: rgb(250, 250, 250);">F&nbsp;</span><span style=3D"color: rgb=
(102, 102, 0); background-color: rgb(250, 250, 250);">&amp;&amp;</span><spa=
n style=3D"color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">call=
able</span><span style=3D"color: rgb(102, 102, 0); background-color: rgb(25=
0, 250, 250);">,</span><span style=3D"color: rgb(0, 0, 0); background-color=
: rgb(250, 250, 250);">&nbsp;</span><span style=3D"color: rgb(102, 0, 102);=
 background-color: rgb(250, 250, 250);">Args</span><span style=3D"color: rg=
b(0, 0, 0); background-color: rgb(250, 250, 250);">&nbsp;</span><span style=
=3D"color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">&amp;&a=
mp;...</span><span style=3D"color: rgb(0, 0, 0); background-color: rgb(250,=
 250, 250);">args</span><span style=3D"color: rgb(102, 102, 0); background-=
color: rgb(250, 250, 250);">)</span></font></div><div><font face=3D"courier=
 new, monospace"><span style=3D"color: rgb(102, 102, 0); background-color: =
rgb(250, 250, 250);">{</span><br></font></div><div><font face=3D"courier ne=
w, monospace"><span style=3D"color: rgb(0, 0, 0); background-color: rgb(250=
, 250, 250);">&nbsp; &nbsp;&nbsp;</span><span style=3D"color: rgb(136, 0, 0=
); background-color: rgb(250, 250, 250);">// do things!</span><span style=
=3D"color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);"><br></span>=
</font><div><span style=3D"color: rgb(102, 102, 0); background-color: rgb(2=
50, 250, 250);"><font face=3D"courier new, monospace">}</font></span></div>=
<div><br></div></div></div>

<p></p>

-- <br />
<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 <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 />
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_330_1342958100.1423864802378--
------=_Part_329_974861409.1423864802378--

.