Topic: Generic function-wrapper object


Author: Hamza Sood <hamza_sood@me.com>
Date: Mon, 9 Apr 2018 08:36:14 -0700 (PDT)
Raw View
------=_Part_23773_924158111.1523288174475
Content-Type: multipart/alternative;
 boundary="----=_Part_23774_1996392239.1523288174476"

------=_Part_23774_1996392239.1523288174476
Content-Type: text/plain; charset="UTF-8"

I propose the inclusion of a function object (somewhat similar to the
deprecated ptr_fun) that looks something like:

template<auto f>
requires is_pointer_v<decltype(f)> &&
         is_function_v<remove_pointer_t<decltype(f)>>
struct func_ptr {
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) noexcept(noexcept(f(forward<Args
>(args)...))) {
    return f(forward<Args>(args)...);
  }
};

The main difference with ptr_fun being that the function pointer is part of
the type.



*Motivation*

The main motivating example is a unique_ptr that needs to call a custom
deleter function. Currently (assuming you don't want to write some
per-deleter boilerplate), you'd need to do something like:
std::unique_ptr<MyType, decltype(&myDeleter)> ptr(something, myDeleter);

This presents a few issues:

   1. You don't get to use the default constructor for unique_ptr. Not a
   big deal but it can be inconvenient.
   2. You aren't actually declaring a unique_ptr that calls the myDeleter
   function, you're declaring a unique_ptr that calls a function pointer with
   the same signature as the myDeleter function. If the object gets passed
   around a bit, the compiler won't be able to inline the deletion and you'll
   probably be left with an indirect call.
   3. For the same reason as issue 2, storing the function pointer doubles
   the size of the object.

I believe that:
std::unique_ptr<MyType, std::func_ptr<myDeleter>> ptr;
solves all of those issues.

--
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/e2229872-0c8a-4673-b452-602959fc938f%40isocpp.org.

------=_Part_23774_1996392239.1523288174476
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I propose the inclusion of a function object (somewhat sim=
ilar to the deprecated ptr_fun) that looks something like:<div><br><div><di=
v class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bord=
er: 1px solid rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint" style=3D"caret-color: rgb(102, 0, =
102);"><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"color: #008;" class=3D"styled-by-prettify">auto</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> f</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br>requires is_pointer_v</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">decltype</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">)&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is_function_v</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">remove_pointer_t</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">decltype</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">f</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)&gt;&gt;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> func_ptr </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">typename</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">decltype</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">operator</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">()(</span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">Args</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&amp;&amp;...</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> args</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> noexcept</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">noexcept</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: #6=
60;" class=3D"styled-by-prettify">(</span><font color=3D"#000000"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">forward</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #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">args</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)...</span></font><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: #660;" class=3D"styled-by-p=
rettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">return</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> f</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #000;" class=3D"styled-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-prettify">Args</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">args</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">)...);</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #66=
0;" 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"st=
yled-by-prettify">};</span></div></code></div><br>The main difference with =
ptr_fun being that the function pointer is part of the type.</div></div><di=
v><br></div><div><br></div><div><br></div><div><b><u>Motivation</u></b></di=
v><div><br></div><div>The main motivating example is a unique_ptr that need=
s to call a custom deleter function. Currently (assuming you don&#39;t want=
 to write some per-deleter boilerplate), you&#39;d need to do something lik=
e:</div><div><div class=3D"prettyprint" style=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"subprettyprint" style=3D"caret-col=
or: rgb(102, 0, 102);"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">unique_pt=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">MyType</span><s=
pan 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=
: #008;" class=3D"styled-by-prettify">decltype</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(&amp;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">myDeleter</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">)&gt;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> ptr</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><font color=3D"#000000"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">something</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> myDeleter</span></font><span style=3D"color: #660=
;" class=3D"styled-by-prettify">);</span></div></code></div><br></div><div>=
This presents a few issues:</div><div><ol><li>You don&#39;t get to use the =
default constructor for unique_ptr. Not a big deal but it can be inconvenie=
nt.</li><li>You aren&#39;t actually declaring a unique_ptr that calls the m=
yDeleter function, you&#39;re declaring a unique_ptr that calls a function =
pointer with the same signature as the myDeleter function. If the object ge=
ts passed around a bit, the compiler won&#39;t be able to inline the deleti=
on and you&#39;ll probably be left with an indirect call.</li><li>For the s=
ame reason as issue 2, storing the function pointer doubles the size of the=
 object.</li></ol><div>I believe that:</div></div><div><div class=3D"pretty=
print" style=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb=
(187, 187, 187); word-wrap: break-word;"><code class=3D"prettyprint"><div c=
lass=3D"subprettyprint" style=3D"caret-color: rgb(102, 0, 102);"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">unique_ptr</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">MyType</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><font color=3D"#000000"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">func_ptr</span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&lt;myDeleter&gt;</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> ptr</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span></font></div></code></div>solves all of those is=
sues.</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/e2229872-0c8a-4673-b452-602959fc938f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e2229872-0c8a-4673-b452-602959fc938f=
%40isocpp.org</a>.<br />

------=_Part_23774_1996392239.1523288174476--

------=_Part_23773_924158111.1523288174475--

.


Author: "'Matt Calabrese' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Mon, 09 Apr 2018 15:46:30 +0000
Raw View
--94eb2c05b49ee859d905696c4f42
Content-Type: text/plain; charset="UTF-8"

On Mon, Apr 9, 2018 at 11:36 AM Hamza Sood <hamza_sood@me.com> wrote:

> I propose the inclusion of a function object (somewhat similar to the
> deprecated ptr_fun) that looks something like:
>
> template<auto f>
> requires is_pointer_v<decltype(f)> &&
>          is_function_v<remove_pointer_t<decltype(f)>>
> struct func_ptr {
>   template<typename... Args>
>   decltype(auto) operator()(Args&&... args) noexcept(noexcept(f(forward<
> Args>(args)...))) {
>     return f(forward<Args>(args)...);
>   }
> };
>
> The main difference with ptr_fun being that the function pointer is part
> of the type.
>


I have proposed something like that here: http://wg21.link/p0477

It is awaiting a revision with some different names, and I will need to
update it to target C++20 (updated constraints, etc.).

-- Matt Calabrese

--
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/CANh8DEk7X8whB5K5GNQai2r9gt52HKEVtxE6aGy78w_%2Bp20BTQ%40mail.gmail.com.

--94eb2c05b49ee859d905696c4f42
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, Ap=
r 9, 2018 at 11:36 AM Hamza Sood &lt;<a href=3D"mailto:hamza_sood@me.com">h=
amza_sood@me.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex"><div dir=3D"ltr">I propose the inclusion of a function obje=
ct (somewhat similar to the deprecated ptr_fun) that looks something like:<=
div><br><div><div class=3D"gmail-m_-767131349022434533prettyprint" style=3D=
"background-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-w=
rap:break-word"><code class=3D"gmail-m_-767131349022434533prettyprint"><div=
 class=3D"gmail-m_-767131349022434533subprettyprint"><span style=3D"color:r=
gb(0,0,136)" class=3D"gmail-m_-767131349022434533styled-by-prettify">templa=
te</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-76713134902=
2434533styled-by-prettify">&lt;</span><span style=3D"color:rgb(0,0,136)" cl=
ass=3D"gmail-m_-767131349022434533styled-by-prettify">auto</span><span styl=
e=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533styled-by-pretti=
fy"> f</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-7671313=
49022434533styled-by-prettify">&gt;</span><span style=3D"color:rgb(0,0,0)" =
class=3D"gmail-m_-767131349022434533styled-by-prettify"><br>requires is_poi=
nter_v</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-7671313=
49022434533styled-by-prettify">&lt;</span><span style=3D"color:rgb(0,0,136)=
" class=3D"gmail-m_-767131349022434533styled-by-prettify">decltype</span><s=
pan style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styl=
ed-by-prettify">(</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-=
767131349022434533styled-by-prettify">f</span><span style=3D"color:rgb(102,=
102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">)&gt;</span=
><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533style=
d-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-=
m_-767131349022434533styled-by-prettify">&amp;&amp;</span><span style=3D"co=
lor:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify"><br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is_function_v</span><span style=3D"color=
:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">&l=
t;</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434=
533styled-by-prettify">remove_pointer_t</span><span style=3D"color:rgb(102,=
102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">&lt;</span>=
<span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-767131349022434533styl=
ed-by-prettify">decltype</span><span style=3D"color:rgb(102,102,0)" class=
=3D"gmail-m_-767131349022434533styled-by-prettify">(</span><span style=3D"c=
olor:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">f<=
/span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-76713134902243=
4533styled-by-prettify">)&gt;&gt;</span><span style=3D"color:rgb(0,0,0)" cl=
ass=3D"gmail-m_-767131349022434533styled-by-prettify"><br></span><span styl=
e=3D"color:rgb(0,0,136)" class=3D"gmail-m_-767131349022434533styled-by-pret=
tify">struct</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-76713=
1349022434533styled-by-prettify"> func_ptr </span><span style=3D"color:rgb(=
102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">{</span=
><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533style=
d-by-prettify"><br>=C2=A0 </span><span style=3D"color:rgb(0,0,136)" class=
=3D"gmail-m_-767131349022434533styled-by-prettify">template</span><span sty=
le=3D"color:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-p=
rettify">&lt;</span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-76=
7131349022434533styled-by-prettify">typename</span><span style=3D"color:rgb=
(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">...</s=
pan><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533st=
yled-by-prettify"> </span><span style=3D"color:rgb(102,0,102)" class=3D"gma=
il-m_-767131349022434533styled-by-prettify">Args</span><span style=3D"color=
:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">&g=
t;</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434=
533styled-by-prettify"><br>=C2=A0 </span><span style=3D"color:rgb(0,0,136)"=
 class=3D"gmail-m_-767131349022434533styled-by-prettify">decltype</span><sp=
an style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533style=
d-by-prettify">(</span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_=
-767131349022434533styled-by-prettify">auto</span><span style=3D"color:rgb(=
102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">)</span=
><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533style=
d-by-prettify"> </span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_=
-767131349022434533styled-by-prettify">operator</span><span style=3D"color:=
rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">()(=
</span><span style=3D"color:rgb(102,0,102)" class=3D"gmail-m_-7671313490224=
34533styled-by-prettify">Args</span><span style=3D"color:rgb(102,102,0)" cl=
ass=3D"gmail-m_-767131349022434533styled-by-prettify">&amp;&amp;...</span><=
span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533styled-=
by-prettify"> args</span><span style=3D"color:rgb(102,102,0)" class=3D"gmai=
l-m_-767131349022434533styled-by-prettify">)</span><span style=3D"color:rgb=
(0,0,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify"> noexcept<=
/span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-76713134902243=
4533styled-by-prettify">(</span><span style=3D"color:rgb(0,0,0)" class=3D"g=
mail-m_-767131349022434533styled-by-prettify">noexcept</span><span style=3D=
"color:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-pretti=
fy">(</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022=
434533styled-by-prettify">f</span><span style=3D"color:rgb(102,102,0)" clas=
s=3D"gmail-m_-767131349022434533styled-by-prettify">(</span><font color=3D"=
#000000"><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434=
533styled-by-prettify">forward</span><span style=3D"color:rgb(102,102,0)" c=
lass=3D"gmail-m_-767131349022434533styled-by-prettify">&lt;</span><span sty=
le=3D"color:rgb(102,0,102)" class=3D"gmail-m_-767131349022434533styled-by-p=
rettify">Args</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-=
767131349022434533styled-by-prettify">&gt;(</span><span style=3D"color:rgb(=
0,0,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">args</span>=
<span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533st=
yled-by-prettify">)...</span></font><span style=3D"color:rgb(102,102,0)" cl=
ass=3D"gmail-m_-767131349022434533styled-by-prettify">)))</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533styled-by-prettif=
y"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-767131349=
022434533styled-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=
=3D"gmail-m_-767131349022434533styled-by-prettify"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-767131349022434533sty=
led-by-prettify">return</span><span style=3D"color:rgb(0,0,0)" class=3D"gma=
il-m_-767131349022434533styled-by-prettify"> f</span><span style=3D"color:r=
gb(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">(</s=
pan><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022434533st=
yled-by-prettify">forward</span><span style=3D"color:rgb(102,102,0)" class=
=3D"gmail-m_-767131349022434533styled-by-prettify">&lt;</span><span style=
=3D"color:rgb(102,0,102)" class=3D"gmail-m_-767131349022434533styled-by-pre=
ttify">Args</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-76=
7131349022434533styled-by-prettify">&gt;(</span><span style=3D"color:rgb(0,=
0,0)" class=3D"gmail-m_-767131349022434533styled-by-prettify">args</span><s=
pan style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styl=
ed-by-prettify">)...);</span><span style=3D"color:rgb(0,0,0)" class=3D"gmai=
l-m_-767131349022434533styled-by-prettify"><br>=C2=A0 </span><span style=3D=
"color:rgb(102,102,0)" class=3D"gmail-m_-767131349022434533styled-by-pretti=
fy">}</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-767131349022=
434533styled-by-prettify"><br></span><span style=3D"color:rgb(102,102,0)" c=
lass=3D"gmail-m_-767131349022434533styled-by-prettify">};</span></div></cod=
e></div><br>The main difference with ptr_fun being that the function pointe=
r is part of the type.</div></div></div></blockquote><div><br></div><div><b=
r></div><div>I have proposed something like that here:=C2=A0<a href=3D"http=
://wg21.link/p0477">http://wg21.link/p0477</a></div><div><br></div><div>It =
is awaiting a revision with some different names, and I will need to update=
 it to target C++20 (updated constraints, etc.).</div><div><br></div><div>-=
- Matt Calabrese</div></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/CANh8DEk7X8whB5K5GNQai2r9gt52HKEVtxE6=
aGy78w_%2Bp20BTQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CANh8DEk7X8whB5=
K5GNQai2r9gt52HKEVtxE6aGy78w_%2Bp20BTQ%40mail.gmail.com</a>.<br />

--94eb2c05b49ee859d905696c4f42--

.