Topic: Member function syntax should match function
Author: Antonio Perez <antonio@perezexcelsior.com>
Date: Tue, 15 May 2018 10:09:13 -0700 (PDT)
Raw View
------=_Part_32100_1373384289.1526404153167
Content-Type: multipart/alternative;
boundary="----=_Part_32101_1149709973.1526404153167"
------=_Part_32101_1149709973.1526404153167
Content-Type: text/plain; charset="UTF-8"
*Proposal: *Allow member functions to be used as though "wrapped" in a
lambda.
To get a clearer picture of what this means, let's define a macro that
wraps the input in a lambda:
#define LAMBDA(x) [&](auto&&... inputs) { return x(inputs...); }
(I an *not* proposing adding this macro to the standard, but rather using
it to define the behavior of my proposed syntax)
If someone writes:
std::vector<int> v;
auto func = v.push_back; //Proposed syntax
This should be equivalent to:
std::vector<int> v;
//This will compile if LAMBDA is defined as above
auto func = LAMBDA(v.push_back);
It should also be possible to pass member functions to higher order
functions:
template<class Func,class... Args>
void RepeatNTimes(size_t n, Func&& function,Args&&... arguments) {
for(size_t i=0;i<n;++i) {
function(arguments...);
}
}
//...
//Later in the code:
std::vector<int> v {};
RepeatNTimes(5, v.push_back, 0); //Proposed syntax
//v now equals {0, 0, 0, 0, 0}
That last line would equivalent to:
RepeatNTimes(5, LAMBDA(v.push_back), 0);//This will compile if LAMBDA is
defined as above
*Sales Pitch: *C++ is powerful precisely because it allows abstraction with
minimal overhead. Thanks to highly aggressive compiler optimization, it's
easy to write short, understandable, and expressive code that's also fast.
Member function are currently cumbersome to use with higher order
functions, and their current syntax is complicated. Making it easy to pass
member functions would add to the flexibility and power of C++, and would
also make the syntax more uniform. Function pointers, lambdas, and functors
can already be passed and assigned with the proposed syntax; why not member
functions too?
--
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/78d38a05-9633-43af-a04f-7a3895b72d53%40isocpp.org.
------=_Part_32101_1149709973.1526404153167
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><b>Proposal:=C2=A0</b>Allow member functions to be us=
ed as though "wrapped" in a lambda.=C2=A0</div><div><br></div><di=
v>To get a clearer picture of what this means, let's define a macro tha=
t wraps the input in a lambda:</div><div><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb(187, 187, 1=
87); word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #800;" class=3D"styled-by-prettify">#defi=
ne</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> LAMBDA<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">x</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 style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">auto</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&&...</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> inputs</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{</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"> x</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">inputs</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 style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span></div></code></div><div>(I an <i>not</i>=C2=A0propos=
ing adding this macro to the standard, but rather using it to define the be=
havior of my proposed syntax)</div><div><br></div>If someone writes:</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 clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><font><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;" class=
=3D"styled-by-prettify">vector</span><span style=3D"color: #080;" class=3D"=
styled-by-prettify"><int></span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> v</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">au=
to</span><font color=3D"#000000"><span style=3D"caret-color: rgb(102, 0, 10=
2);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> func </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> v</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">push_back</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: #800;" class=3D"styl=
ed-by-prettify">//Proposed syntax</span></span></font></font></div></code><=
/div>This should be equivalent to:</div><div><div class=3D"prettyprint" sty=
le=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"su=
bprettyprint"><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;" class=3D"styled-by-prettify">vector</span><span=
style=3D"color: #080;" class=3D"styled-by-prettify"><int></span><fon=
t color=3D"#000000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> v</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">//This will compile =
if LAMBDA is defined as above</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span><span style=3D"caret-color: rgb(102, 0, 102);=
"><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> func </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> LAMBDA</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">v</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">push_back</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">);</span></span></font></div></code></div><br>It should also =
be possible to pass member functions to higher order functions:<br></div><d=
iv><br></div><div><div class=3D"prettyprint" style=3D"background-color: rgb=
(250, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: break-wor=
d;"><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"><</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><font><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Func</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Arg=
s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">RepeatNTimes</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">size_t n</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: #606;" class=3D"styled-b=
y-prettify">Func</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&&</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">fun=
ction</span><span style=3D"color: #660;" 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">&&...</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> arguments</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{</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-prettify">for</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">(</span><font color=3D"#000000"><span style=
=3D"caret-color: rgb(102, 0, 102);"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">size_t i</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">=3D</span><span style=3D"color: #066;" class=3D"styled-by-=
prettify">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">i</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">n</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;++</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">i</span><span style=3D"color: #660;" cl=
ass=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></span></span></font><font color=3D"#666600" style=3D"caret-color: rgb(=
102, 0, 102);"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">function</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
arguments</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 =C2=A0</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><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></span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">//...</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
#800;" class=3D"styled-by-prettify">//Later in the code:</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span></font><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"colo=
r: #000;" class=3D"styled-by-prettify">vector</span><span style=3D"color: #=
080;" class=3D"styled-by-prettify"><int></span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> v </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: #606;" class=3D"st=
yled-by-prettify">RepeatNTimes</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><font color=3D"#006666" style=3D"caret-color: r=
gb(102, 0, 102);"><span style=3D"color: #066;" class=3D"styled-by-prettify"=
>5</span></font><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">push_back</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: #066;" =
class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettif=
y">//Proposed syntax</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">//v now equals {0, 0, 0, 0, 0}</span></font></div></code></div><div><br=
></div><div>That last line would equivalent to:</div><div><div class=3D"pre=
ttyprint" style=3D"background-color: rgb(250, 250, 250); border: 1px solid =
rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"prettyprint"><di=
v class=3D"subprettyprint" style=3D"caret-color: rgb(102, 0, 102);"><font c=
olor=3D"#000000"><span style=3D"color: #606;" class=3D"styled-by-prettify">=
RepeatNTimes</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">5</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> LAMBDA</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">v</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">push_back</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: #066;" class=3D"styled-by-prettify=
">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</spa=
n></font><span style=3D"caret-color: rgb(136, 0, 0); color: rgb(136, 0, 0);=
"><span style=3D"color: #800;" class=3D"styled-by-prettify">//This will com=
pile if LAMBDA is defined as above</span></span></div></code></div><br><b>S=
ales Pitch:=C2=A0</b>C++ is powerful precisely because it allows abstractio=
n with minimal overhead. Thanks to highly aggressive compiler optimization,=
it's easy to write short, understandable, and expressive code that'=
;s also fast.</div></div><div><br></div><div>Member function are currently =
cumbersome to use with higher order functions, and their current syntax is =
complicated. Making it easy to pass member functions would add to the flexi=
bility and power of C++, and would also make the syntax more uniform. Funct=
ion pointers, lambdas, and functors can already be passed and assigned with=
the proposed syntax; why not member functions too?</div><div><br></div></d=
iv>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/78d38a05-9633-43af-a04f-7a3895b72d53%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/78d38a05-9633-43af-a04f-7a3895b72d53=
%40isocpp.org</a>.<br />
------=_Part_32101_1149709973.1526404153167--
------=_Part_32100_1373384289.1526404153167--
.
Author: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Date: Tue, 15 May 2018 18:14:22 +0100
Raw View
--000000000000f759ef056c41bcba
Content-Type: text/plain; charset="UTF-8"
Just a question - are you aware of std::invoke?
http://en.cppreference.com/w/cpp/utility/functional/invoke
G
On Tue, May 15, 2018 at 6:09 PM, Antonio Perez <antonio@perezexcelsior.com>
wrote:
> *Proposal: *Allow member functions to be used as though "wrapped" in a
> lambda.
>
> To get a clearer picture of what this means, let's define a macro that
> wraps the input in a lambda:
> #define LAMBDA(x) [&](auto&&... inputs) { return x(inputs...); }
> (I an *not* proposing adding this macro to the standard, but rather using
> it to define the behavior of my proposed syntax)
>
> If someone writes:
> std::vector<int> v;
> auto func = v.push_back; //Proposed syntax
> This should be equivalent to:
> std::vector<int> v;
> //This will compile if LAMBDA is defined as above
> auto func = LAMBDA(v.push_back);
>
> It should also be possible to pass member functions to higher order
> functions:
>
> template<class Func,class... Args>
> void RepeatNTimes(size_t n, Func&& function,Args&&... arguments) {
> for(size_t i=0;i<n;++i) {
> function(arguments...);
> }
> }
> //...
> //Later in the code:
>
> std::vector<int> v {};
> RepeatNTimes(5, v.push_back, 0); //Proposed syntax
> //v now equals {0, 0, 0, 0, 0}
>
> That last line would equivalent to:
> RepeatNTimes(5, LAMBDA(v.push_back), 0);//This will compile if LAMBDA is
> defined as above
>
> *Sales Pitch: *C++ is powerful precisely because it allows abstraction
> with minimal overhead. Thanks to highly aggressive compiler optimization,
> it's easy to write short, understandable, and expressive code that's also
> fast.
>
> Member function are currently cumbersome to use with higher order
> functions, and their current syntax is complicated. Making it easy to pass
> member functions would add to the flexibility and power of C++, and would
> also make the syntax more uniform. Function pointers, lambdas, and functors
> can already be passed and assigned with the proposed syntax; why not member
> functions too?
>
> --
> 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/78d38a05-9633-43af-
> a04f-7a3895b72d53%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/78d38a05-9633-43af-a04f-7a3895b72d53%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
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/CAANG%3DkXef1RNtci9Hq4Cnu8fjpoJYLZJ5En-gsrnDeFJWdQUeg%40mail.gmail.com.
--000000000000f759ef056c41bcba
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Just a question - are you aware of std::invoke?<div><br></=
div><div><a href=3D"http://en.cppreference.com/w/cpp/utility/functional/inv=
oke">http://en.cppreference.com/w/cpp/utility/functional/invoke</a></div><d=
iv><br></div><div><br></div><div>G</div></div><div class=3D"gmail_extra"><b=
r><div class=3D"gmail_quote">On Tue, May 15, 2018 at 6:09 PM, Antonio Perez=
<span dir=3D"ltr"><<a href=3D"mailto:antonio@perezexcelsior.com" target=
=3D"_blank">antonio@perezexcelsior.com</a>></span> wrote:<br><blockquote=
class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div dir=3D"ltr"><div><b>Proposal:=C2=A0</b>Allow membe=
r functions to be used as though "wrapped" in a lambda.=C2=A0</di=
v><div><br></div><div>To get a clearer picture of what this means, let'=
s define a macro that wraps the input in a lambda:</div><div><div class=3D"=
gmail-m_-2705293612060622150prettyprint" style=3D"background-color:rgb(250,=
250,250);border:1px solid rgb(187,187,187);word-wrap:break-word"><code clas=
s=3D"gmail-m_-2705293612060622150prettyprint"><div class=3D"gmail-m_-270529=
3612060622150subprettyprint"><span style=3D"color:rgb(136,0,0)" class=3D"gm=
ail-m_-2705293612060622150styled-by-prettify">#define</span><span style=3D"=
color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">=
LAMBDA</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-270529=
3612060622150styled-by-prettify">(</span><span style=3D"color:rgb(0,0,0)" c=
lass=3D"gmail-m_-2705293612060622150styled-by-prettify">x</span><span style=
=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-pr=
ettify">)</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-27052936=
12060622150styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)"=
class=3D"gmail-m_-2705293612060622150styled-by-prettify">[&](</span><s=
pan style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-2705293612060622150style=
d-by-prettify">auto</span><span style=3D"color:rgb(102,102,0)" class=3D"gma=
il-m_-2705293612060622150styled-by-prettify">&&...</span><span styl=
e=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prett=
ify"> inputs</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2=
705293612060622150styled-by-prettify">)</span><span style=3D"color:rgb(0,0,=
0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"> </span><span =
style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-=
by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-270=
5293612060622150styled-by-prettify"> </span><span style=3D"color:rgb(0,0,13=
6)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">return</span><=
span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled=
-by-prettify"> x</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-=
m_-2705293612060622150styled-by-prettify">(</span><span style=3D"color:rgb(=
0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">inputs</sp=
an><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-27052936120606221=
50styled-by-prettify">...);</span><span style=3D"color:rgb(0,0,0)" class=3D=
"gmail-m_-2705293612060622150styled-by-prettify"> </span><span style=3D"col=
or:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"=
>}</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-270529361206062=
2150styled-by-prettify"><br></span></div></code></div><div>(I an <i>not</i>=
=C2=A0proposing adding this macro to the standard, but rather using it to d=
efine the behavior of my proposed syntax)</div><div><br></div>If someone wr=
ites:</div><div><div class=3D"gmail-m_-2705293612060622150prettyprint" styl=
e=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187,187);wo=
rd-wrap:break-word"><code class=3D"gmail-m_-2705293612060622150prettyprint"=
><div class=3D"gmail-m_-2705293612060622150subprettyprint"><font><span styl=
e=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prett=
ify">std</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-27052=
93612060622150styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)"=
class=3D"gmail-m_-2705293612060622150styled-by-prettify">vector</span><spa=
n style=3D"color:rgb(0,136,0)" class=3D"gmail-m_-2705293612060622150styled-=
by-prettify"><int></span><span style=3D"color:rgb(0,0,0)" class=3D"gm=
ail-m_-2705293612060622150styled-by-prettify"> v</span><span style=3D"color=
:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">;=
</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-27052936120606221=
50styled-by-prettify"><br></span><span style=3D"color:rgb(0,0,136)" class=
=3D"gmail-m_-2705293612060622150styled-by-prettify">auto</span><font color=
=3D"#000000"><span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-27052=
93612060622150styled-by-prettify"> func </span><span style=3D"color:rgb(102=
,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">=3D</span=
><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styl=
ed-by-prettify"> v</span><span style=3D"color:rgb(102,102,0)" class=3D"gmai=
l-m_-2705293612060622150styled-by-prettify">.</span><span style=3D"color:rg=
b(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">push_bac=
k</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-270529361206=
0622150styled-by-prettify">;</span><span style=3D"color:rgb(0,0,0)" class=
=3D"gmail-m_-2705293612060622150styled-by-prettify"> </span><span style=3D"=
color:rgb(136,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify=
">//Proposed syntax</span></span></font></font></div></code></div>This shou=
ld be equivalent to:</div><div><div class=3D"gmail-m_-2705293612060622150pr=
ettyprint" style=3D"background-color:rgb(250,250,250);border:1px solid rgb(=
187,187,187);word-wrap:break-word"><code class=3D"gmail-m_-2705293612060622=
150prettyprint"><div class=3D"gmail-m_-2705293612060622150subprettyprint"><=
span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled=
-by-prettify">std</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail=
-m_-2705293612060622150styled-by-prettify">::</span><span style=3D"color:rg=
b(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">vector</=
span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_-27052936120606221=
50styled-by-prettify"><int></span><font color=3D"#000000"><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-pretti=
fy"> v</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293=
612060622150styled-by-prettify">;</span><span style=3D"color:rgb(0,0,0)" cl=
ass=3D"gmail-m_-2705293612060622150styled-by-prettify"><br></span><span sty=
le=3D"color:rgb(136,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-pr=
ettify">//This will compile if LAMBDA is defined as above</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-pretti=
fy"><br></span><span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-2=
705293612060622150styled-by-prettify">auto</span><span style=3D"color:rgb(0=
,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"> func </spa=
n><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-270529361206062215=
0styled-by-prettify">=3D</span><span style=3D"color:rgb(0,0,0)" class=3D"gm=
ail-m_-2705293612060622150styled-by-prettify"> LAMBDA</span><span style=3D"=
color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-pretti=
fy">(</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-270529361206=
0622150styled-by-prettify">v</span><span style=3D"color:rgb(102,102,0)" cla=
ss=3D"gmail-m_-2705293612060622150styled-by-prettify">.</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-pretti=
fy">push_back</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-=
2705293612060622150styled-by-prettify">);</span></span></font></div></code>=
</div><br>It should also be possible to pass member functions to higher ord=
er functions:<br></div><div><br></div><div><div class=3D"gmail-m_-270529361=
2060622150prettyprint" style=3D"background-color:rgb(250,250,250);border:1p=
x solid rgb(187,187,187);word-wrap:break-word"><code class=3D"gmail-m_-2705=
293612060622150prettyprint"><div class=3D"gmail-m_-2705293612060622150subpr=
ettyprint"><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-27052936120=
60622150styled-by-prettify">template</span><span style=3D"color:rgb(102,102=
,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"><</span><s=
pan style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-2705293612060622150style=
d-by-prettify">class</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-=
m_-2705293612060622150styled-by-prettify"> </span><font><span style=3D"colo=
r:rgb(102,0,102)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">=
Func</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-270529361=
2060622150styled-by-prettify">,</span><span style=3D"color:rgb(0,0,136)" cl=
ass=3D"gmail-m_-2705293612060622150styled-by-prettify">class</span><span st=
yle=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by=
-prettify">...</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-270=
5293612060622150styled-by-prettify"> </span><span style=3D"color:rgb(102,0,=
102)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">Args</span><=
span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150st=
yled-by-prettify">></span><span style=3D"color:rgb(0,0,0)" class=3D"gmai=
l-m_-2705293612060622150styled-by-prettify"><br></span><span style=3D"color=
:rgb(0,0,136)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">voi=
d</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622=
150styled-by-prettify"> </span><span style=3D"color:rgb(102,0,102)" class=
=3D"gmail-m_-2705293612060622150styled-by-prettify">RepeatNTimes</span><spa=
n style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150style=
d-by-prettify">(</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2=
705293612060622150styled-by-prettify">size_t n</span><span style=3D"color:r=
gb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">,</=
span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150=
styled-by-prettify"> </span><span style=3D"color:rgb(102,0,102)" class=3D"g=
mail-m_-2705293612060622150styled-by-prettify">Func</span><span style=3D"co=
lor:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify=
">&&</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-27052=
93612060622150styled-by-prettify"> </span><span style=3D"color:rgb(0,0,136)=
" class=3D"gmail-m_-2705293612060622150styled-by-prettify">function</span><=
span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150st=
yled-by-prettify">,</span><span style=3D"color:rgb(102,0,102)" class=3D"gma=
il-m_-2705293612060622150styled-by-prettify">Args</span><span style=3D"colo=
r:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">=
&&...</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705=
293612060622150styled-by-prettify"> arguments</span><span style=3D"color:rg=
b(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">)</s=
pan><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150s=
tyled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gm=
ail-m_-2705293612060622150styled-by-prettify">{</span><span style=3D"color:=
rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"><br>=
=C2=A0 =C2=A0</span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-27=
05293612060622150styled-by-prettify">for</span><span style=3D"color:rgb(102=
,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">(</span><=
font color=3D"#000000"><span><span style=3D"color:rgb(0,0,0)" class=3D"gmai=
l-m_-2705293612060622150styled-by-prettify">size_t i</span><span style=3D"c=
olor:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettif=
y">=3D</span><span style=3D"color:rgb(0,102,102)" class=3D"gmail-m_-2705293=
612060622150styled-by-prettify">0</span><span style=3D"color:rgb(102,102,0)=
" class=3D"gmail-m_-2705293612060622150styled-by-prettify">;</span><span st=
yle=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-pre=
ttify">i</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-27052=
93612060622150styled-by-prettify"><</span><span style=3D"color:rgb(0,0,0=
)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">n</span><span s=
tyle=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-b=
y-prettify">;++</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-27=
05293612060622150styled-by-prettify">i</span><span style=3D"color:rgb(102,1=
02,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">)</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-b=
y-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-=
2705293612060622150styled-by-prettify">{</span><span style=3D"color:rgb(0,0=
,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"><br></span></=
span></font><font color=3D"#666600"><span style=3D"color:rgb(0,0,0)" class=
=3D"gmail-m_-2705293612060622150styled-by-prettify">=C2=A0 =C2=A0 =C2=A0 </=
span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-27052936120606221=
50styled-by-prettify">function</span><span style=3D"color:rgb(102,102,0)" c=
lass=3D"gmail-m_-2705293612060622150styled-by-prettify">(</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-pretti=
fy">arguments</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-=
2705293612060622150styled-by-prettify">...);</span><span style=3D"color:rgb=
(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"><br>=C2=
=A0 =C2=A0</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-270=
5293612060622150styled-by-prettify">}</span><span style=3D"color:rgb(0,0,0)=
" class=3D"gmail-m_-2705293612060622150styled-by-prettify"><br></span><span=
style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled=
-by-prettify">}</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-27=
05293612060622150styled-by-prettify"><br></span><span style=3D"color:rgb(13=
6,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">//...</spa=
n><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150sty=
led-by-prettify"><br></span><span style=3D"color:rgb(136,0,0)" class=3D"gma=
il-m_-2705293612060622150styled-by-prettify">//Later in the code:</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-b=
y-prettify"><br><br></span></font><span style=3D"color:rgb(0,0,0)" class=3D=
"gmail-m_-2705293612060622150styled-by-prettify">std</span><span style=3D"c=
olor:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettif=
y">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-270529361206=
0622150styled-by-prettify">vector</span><span style=3D"color:rgb(0,136,0)" =
class=3D"gmail-m_-2705293612060622150styled-by-prettify"><int></span>=
<span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150style=
d-by-prettify"> v </span><span style=3D"color:rgb(102,102,0)" class=3D"gmai=
l-m_-2705293612060622150styled-by-prettify">{};</span><span style=3D"color:=
rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"><br></=
span><span style=3D"color:rgb(102,0,102)" class=3D"gmail-m_-270529361206062=
2150styled-by-prettify">RepeatNTimes</span><span style=3D"color:rgb(102,102=
,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">(</span><font=
color=3D"#006666"><span style=3D"color:rgb(0,102,102)" class=3D"gmail-m_-2=
705293612060622150styled-by-prettify">5</span></font><span style=3D"color:r=
gb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">,</=
span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150=
styled-by-prettify"> v</span><span style=3D"color:rgb(102,102,0)" class=3D"=
gmail-m_-2705293612060622150styled-by-prettify">.</span><span style=3D"colo=
r:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">push=
_back</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-27052936=
12060622150styled-by-prettify">,</span><span style=3D"color:rgb(0,0,0)" cla=
ss=3D"gmail-m_-2705293612060622150styled-by-prettify"> </span><span style=
=3D"color:rgb(0,102,102)" class=3D"gmail-m_-2705293612060622150styled-by-pr=
ettify">0</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705=
293612060622150styled-by-prettify">);</span><span style=3D"color:rgb(0,0,0)=
" class=3D"gmail-m_-2705293612060622150styled-by-prettify"> </span><span st=
yle=3D"color:rgb(136,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-p=
rettify">//Proposed syntax</span><span style=3D"color:rgb(0,0,0)" class=3D"=
gmail-m_-2705293612060622150styled-by-prettify"><br></span><span style=3D"c=
olor:rgb(136,0,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify"=
>//v now equals {0, 0, 0, 0, 0}</span></font></div></code></div><div><br></=
div><div>That last line would equivalent to:</div><div><div class=3D"gmail-=
m_-2705293612060622150prettyprint" style=3D"background-color:rgb(250,250,25=
0);border:1px solid rgb(187,187,187);word-wrap:break-word"><code class=3D"g=
mail-m_-2705293612060622150prettyprint"><div class=3D"gmail-m_-270529361206=
0622150subprettyprint"><font color=3D"#000000"><span style=3D"color:rgb(102=
,0,102)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">RepeatNTi=
mes</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612=
060622150styled-by-prettify">(</span><span style=3D"color:rgb(0,102,102)" c=
lass=3D"gmail-m_-2705293612060622150styled-by-prettify">5</span><span style=
=3D"color:rgb(102,102,0)" class=3D"gmail-m_-2705293612060622150styled-by-pr=
ettify">,</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-27052936=
12060622150styled-by-prettify"> LAMBDA</span><span style=3D"color:rgb(102,1=
02,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">(</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-2705293612060622150styled-b=
y-prettify">v</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-=
2705293612060622150styled-by-prettify">.</span><span style=3D"color:rgb(0,0=
,0)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">push_back</sp=
an><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-27052936120606221=
50styled-by-prettify">),</span><span style=3D"color:rgb(0,0,0)" class=3D"gm=
ail-m_-2705293612060622150styled-by-prettify"> </span><span style=3D"color:=
rgb(0,102,102)" class=3D"gmail-m_-2705293612060622150styled-by-prettify">0<=
/span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-27052936120606=
22150styled-by-prettify">);</span></font><span style=3D"color:rgb(136,0,0)"=
><span style=3D"color:rgb(136,0,0)" class=3D"gmail-m_-2705293612060622150st=
yled-by-prettify">//This will compile if LAMBDA is defined as above</span><=
/span></div></code></div><br><b>Sales Pitch:=C2=A0</b>C++ is powerful preci=
sely because it allows abstraction with minimal overhead. Thanks to highly =
aggressive compiler optimization, it's easy to write short, understanda=
ble, and expressive code that's also fast.</div></div><div><br></div><d=
iv>Member function are currently cumbersome to use with higher order functi=
ons, and their current syntax is complicated. Making it easy to pass member=
functions would add to the flexibility and power of C++, and would also ma=
ke the syntax more uniform. Function pointers, lambdas, and functors can al=
ready be passed and assigned with the proposed syntax; why not member funct=
ions too?</div><span class=3D"gmail-HOEnZb"><font color=3D"#888888"><div><b=
r></div></font></span></div><span class=3D"gmail-HOEnZb"><font color=3D"#88=
8888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/78d38a05-9633-43af-a04f-7a3895b72d53%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/78d3=
8a05-9633-43af-<wbr>a04f-7a3895b72d53%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAANG%3DkXef1RNtci9Hq4Cnu8fjpoJYLZJ5E=
n-gsrnDeFJWdQUeg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkXef1RN=
tci9Hq4Cnu8fjpoJYLZJ5En-gsrnDeFJWdQUeg%40mail.gmail.com</a>.<br />
--000000000000f759ef056c41bcba--
.
Author: Antonio Perez <antonio@perezexcelsior.com>
Date: Tue, 15 May 2018 11:37:29 -0700 (PDT)
Raw View
------=_Part_32693_1841917422.1526409449703
Content-Type: multipart/alternative;
boundary="----=_Part_32694_1090087564.1526409449703"
------=_Part_32694_1090087564.1526409449703
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I am aware of std::invoke.
The goal of my proposed addition is to make it easier to use member=20
functions as callable objects. Currently you have to pass a pointer to the=
=20
member function, as well as an object to call it on (meaning that higher=20
order functions need additional overloads just to work with member=20
functions). Why not allow passing the object and it's member function=20
together as single callable object?
On Tuesday, May 15, 2018 at 11:14:44 AM UTC-6, Ga=C5=A1per A=C5=BEman wrote=
:
>
> Just a question - are you aware of std::invoke?
>
> http://en.cppreference.com/w/cpp/utility/functional/invoke
>
>
> G
>
> On Tue, May 15, 2018 at 6:09 PM, Antonio Perez <ant...@perezexcelsior.com=
=20
> <javascript:>> wrote:
>
>> *Proposal: *Allow member functions to be used as though "wrapped" in a=
=20
>> lambda.=20
>>
>> To get a clearer picture of what this means, let's define a macro that=
=20
>> wraps the input in a lambda:
>> #define LAMBDA(x) [&](auto&&... inputs) { return x(inputs...); }
>> (I an *not* proposing adding this macro to the standard, but rather=20
>> using it to define the behavior of my proposed syntax)
>>
>> If someone writes:
>> std::vector<int> v;
>> auto func =3D v.push_back; //Proposed syntax
>> This should be equivalent to:
>> std::vector<int> v;
>> //This will compile if LAMBDA is defined as above
>> auto func =3D LAMBDA(v.push_back);
>>
>> It should also be possible to pass member functions to higher order=20
>> functions:
>>
>> template<class Func,class... Args>
>> void RepeatNTimes(size_t n, Func&& function,Args&&... arguments) {
>> for(size_t i=3D0;i<n;++i) {
>> function(arguments...);
>> }
>> }
>> //...
>> //Later in the code:
>>
>> std::vector<int> v {};
>> RepeatNTimes(5, v.push_back, 0); //Proposed syntax
>> //v now equals {0, 0, 0, 0, 0}
>>
>> That last line would equivalent to:
>> RepeatNTimes(5, LAMBDA(v.push_back), 0);//This will compile if LAMBDA is=
=20
>> defined as above
>>
>> *Sales Pitch: *C++ is powerful precisely because it allows abstraction=
=20
>> with minimal overhead. Thanks to highly aggressive compiler optimization=
,=20
>> it's easy to write short, understandable, and expressive code that's als=
o=20
>> fast.
>>
>> Member function are currently cumbersome to use with higher order=20
>> functions, and their current syntax is complicated. Making it easy to pa=
ss=20
>> member functions would add to the flexibility and power of C++, and woul=
d=20
>> also make the syntax more uniform. Function pointers, lambdas, and funct=
ors=20
>> can already be passed and assigned with the proposed syntax; why not mem=
ber=20
>> functions too?
>>
>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/78d38a05-96=
33-43af-a04f-7a3895b72d53%40isocpp.org=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/78d38a05-9=
633-43af-a04f-7a3895b72d53%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/ced4dd3b-4eaa-4e41-a91f-b78e40564933%40isocpp.or=
g.
------=_Part_32694_1090087564.1526409449703
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I am aware of std::invoke.<div><br></div><div>The goal of =
my proposed addition is to make it easier to use member functions as callab=
le objects. Currently you have to pass a pointer to the member function, as=
well as an object to call it on (meaning that higher order functions need =
additional overloads just to work with member functions). Why not allow pas=
sing the object and it's member function together as single callable ob=
ject?<br><div><br>On Tuesday, May 15, 2018 at 11:14:44 AM UTC-6, Ga=C5=A1pe=
r A=C5=BEman wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr">Just a question - are you aware of std::invoke?<div><br></div><div><a=
href=3D"http://en.cppreference.com/w/cpp/utility/functional/invoke" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.goo=
gle.com/url?q\x3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Futility%2Ffun=
ctional%2Finvoke\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG1VZE_zGVGE-4dTSCH=
vV95lvBDJg';return true;" onclick=3D"this.href=3D'http://www.google=
..com/url?q\x3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Futility%2Ffuncti=
onal%2Finvoke\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG1VZE_zGVGE-4dTSCHvV9=
5lvBDJg';return true;">http://en.cppreference.com/w/<wbr>cpp/utility/fu=
nctional/invoke</a></div><div><br></div><div><br></div><div>G</div></div><d=
iv><br><div class=3D"gmail_quote">On Tue, May 15, 2018 at 6:09 PM, Antonio =
Perez <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-o=
bfuscated-mailto=3D"1U03qMoACQAJ" rel=3D"nofollow" onmousedown=3D"this.href=
=3D'javascript:';return true;" onclick=3D"this.href=3D'javascri=
pt:';return true;">ant...@perezexcelsior.com</a>></span> wrote:<br><=
blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px=
#ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><b>Proposal:=C2=A0</b>A=
llow member functions to be used as though "wrapped" in a lambda.=
=C2=A0</div><div><br></div><div>To get a clearer picture of what this means=
, let's define a macro that wraps the input in a lambda:</div><div><div=
style=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187,18=
7);word-wrap:break-word"><code><div><span style=3D"color:rgb(136,0,0)">#def=
ine</span><span style=3D"color:rgb(0,0,0)"> LAMBDA</span><span style=3D"col=
or:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">x</span><span s=
tyle=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </s=
pan><span style=3D"color:rgb(102,102,0)">[&](</span><span style=3D"colo=
r:rgb(0,0,136)">auto</span><span style=3D"color:rgb(102,102,0)">&&.=
...</span><span style=3D"color:rgb(0,0,0)"> inputs</span><span style=3D"colo=
r:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"> </span><span st=
yle=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(0,0,136)">return</span><span style=3D"color:rgb=
(0,0,0)"> x</span><span style=3D"color:rgb(102,102,0)">(</span><span style=
=3D"color:rgb(0,0,0)">inputs</span><span style=3D"color:rgb(102,102,0)">...=
);</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(=
102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span></div></cod=
e></div><div>(I an <i>not</i>=C2=A0proposing adding this macro to the stand=
ard, but rather using it to define the behavior of my proposed syntax)</div=
><div><br></div>If someone writes:</div><div><div style=3D"background-color=
:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap:break-word"><=
code><div><font><span style=3D"color:rgb(0,0,0)">std</span><span style=3D"c=
olor:rgb(102,102,0)">::</span><span style=3D"color:rgb(0,0,0)">vector</span=
><span style=3D"color:rgb(0,136,0)"><int></span><span style=3D"color:=
rgb(0,0,0)"> v</span><span style=3D"color:rgb(102,102,0)">;</span><span sty=
le=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)">auto<=
/span><font color=3D"#000000"><span><span style=3D"color:rgb(0,0,0)"> func =
</span><span style=3D"color:rgb(102,102,0)">=3D</span><span style=3D"color:=
rgb(0,0,0)"> v</span><span style=3D"color:rgb(102,102,0)">.</span><span sty=
le=3D"color:rgb(0,0,0)">push_back</span><span style=3D"color:rgb(102,102,0)=
">;</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb=
(136,0,0)">//Proposed syntax</span></span></font></font></div></code></div>=
This should be equivalent to:</div><div><div style=3D"background-color:rgb(=
250,250,250);border:1px solid rgb(187,187,187);word-wrap:break-word"><code>=
<div><span style=3D"color:rgb(0,0,0)">std</span><span style=3D"color:rgb(10=
2,102,0)">::</span><span style=3D"color:rgb(0,0,0)">vector</span><span styl=
e=3D"color:rgb(0,136,0)"><int></span><font color=3D"#000000"><span st=
yle=3D"color:rgb(0,0,0)"> v</span><span style=3D"color:rgb(102,102,0)">;</s=
pan><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(13=
6,0,0)">//This will compile if LAMBDA is defined as above</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span><span style=3D"color:rgb(0,0,136)">a=
uto</span><span style=3D"color:rgb(0,0,0)"> func </span><span style=3D"colo=
r:rgb(102,102,0)">=3D</span><span style=3D"color:rgb(0,0,0)"> LAMBDA</span>=
<span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0=
)">v</span><span style=3D"color:rgb(102,102,0)">.</span><span style=3D"colo=
r:rgb(0,0,0)">push_back</span><span style=3D"color:rgb(102,102,0)">);</span=
></span></font></div></code></div><br>It should also be possible to pass me=
mber functions to higher order functions:<br></div><div><br></div><div><div=
style=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187,18=
7);word-wrap:break-word"><code><div><span style=3D"color:rgb(0,0,136)">temp=
late</span><span style=3D"color:rgb(102,102,0)"><</span><span style=3D"c=
olor:rgb(0,0,136)">class</span><span style=3D"color:rgb(0,0,0)"> </span><fo=
nt><span style=3D"color:rgb(102,0,102)">Func</span><span style=3D"color:rgb=
(102,102,0)">,</span><span style=3D"color:rgb(0,0,136)">class</span><span s=
tyle=3D"color:rgb(102,102,0)">...</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(102,0,102)">Args</span><span style=3D"color:=
rgb(102,102,0)">></span><span style=3D"color:rgb(0,0,0)"><br></span><spa=
n style=3D"color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)">=
</span><span style=3D"color:rgb(102,0,102)">RepeatNTimes</span><span style=
=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">size_t n=
</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(102,0,102)">Func</span><span sty=
le=3D"color:rgb(102,102,0)">&&</span><span style=3D"color:rgb(0,0,0=
)"> </span><span style=3D"color:rgb(0,0,136)">function</span><span style=3D=
"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(102,0,102)">Args</s=
pan><span style=3D"color:rgb(102,102,0)">&&...</span><span style=3D=
"color:rgb(0,0,0)"> arguments</span><span style=3D"color:rgb(102,102,0)">)<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102=
,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0</span><=
span style=3D"color:rgb(0,0,136)">for</span><span style=3D"color:rgb(102,10=
2,0)">(</span><font color=3D"#000000"><span><span style=3D"color:rgb(0,0,0)=
">size_t i</span><span style=3D"color:rgb(102,102,0)">=3D</span><span style=
=3D"color:rgb(0,102,102)">0</span><span style=3D"color:rgb(102,102,0)">;</s=
pan><span style=3D"color:rgb(0,0,0)">i</span><span style=3D"color:rgb(102,1=
02,0)"><</span><span style=3D"color:rgb(0,0,0)">n</span><span style=3D"c=
olor:rgb(102,102,0)">;++</span><span style=3D"color:rgb(0,0,0)">i</span><sp=
an style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)">=
</span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:r=
gb(0,0,0)"><br></span></span></font><font color=3D"#666600"><span style=3D"=
color:rgb(0,0,0)">=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,=
136)">function</span><span style=3D"color:rgb(102,102,0)">(</span><span sty=
le=3D"color:rgb(0,0,0)">arguments</span><span style=3D"color:rgb(102,102,0)=
">...);</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0</span><spa=
n style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><=
br></span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color=
:rgb(0,0,0)"><br></span><span style=3D"color:rgb(136,0,0)">//...</span><spa=
n style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(136,0,0)">=
//Later in the code:</span><span style=3D"color:rgb(0,0,0)"><br><br></span>=
</font><span style=3D"color:rgb(0,0,0)">std</span><span style=3D"color:rgb(=
102,102,0)">::</span><span style=3D"color:rgb(0,0,0)">vector</span><span st=
yle=3D"color:rgb(0,136,0)"><int></span><span style=3D"color:rgb(0,0,0=
)"> v </span><span style=3D"color:rgb(102,102,0)">{};</span><span style=3D"=
color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,0,102)">RepeatNTi=
mes</span><span style=3D"color:rgb(102,102,0)">(</span><font color=3D"#0066=
66"><span style=3D"color:rgb(0,102,102)">5</span></font><span style=3D"colo=
r:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> v</span><span s=
tyle=3D"color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">push=
_back</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"col=
or:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">0</span><span s=
tyle=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"> </=
span><span style=3D"color:rgb(136,0,0)">//Proposed syntax</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(136,0,0)">//v now=
equals {0, 0, 0, 0, 0}</span></font></div></code></div><div><br></div><div=
>That last line would equivalent to:</div><div><div style=3D"background-col=
or:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap:break-word"=
><code><div><font color=3D"#000000"><span style=3D"color:rgb(102,0,102)">Re=
peatNTimes</span><span style=3D"color:rgb(102,102,0)">(</span><span style=
=3D"color:rgb(0,102,102)">5</span><span style=3D"color:rgb(102,102,0)">,</s=
pan><span style=3D"color:rgb(0,0,0)"> LAMBDA</span><span style=3D"color:rgb=
(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">v</span><span style=
=3D"color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">push_bac=
k</span><span style=3D"color:rgb(102,102,0)">),</span><span style=3D"color:=
rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">0</span><span styl=
e=3D"color:rgb(102,102,0)">);</span></font><span style=3D"color:rgb(136,0,0=
)"><span style=3D"color:rgb(136,0,0)">//This will compile if LAMBDA is defi=
ned as above</span></span></div></code></div><br><b>Sales Pitch:=C2=A0</b>C=
++ is powerful precisely because it allows abstraction with minimal overhea=
d. Thanks to highly aggressive compiler optimization, it's easy to writ=
e short, understandable, and expressive code that's also fast.</div></d=
iv><div><br></div><div>Member function are currently cumbersome to use with=
higher order functions, and their current syntax is complicated. Making it=
easy to pass member functions would add to the flexibility and power of C+=
+, and would also make the syntax more uniform. Function pointers, lambdas,=
and functors can already be passed and assigned with the proposed syntax; =
why not member functions too?</div><span><font color=3D"#888888"><div><br><=
/div></font></span></div><span><font color=3D"#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
1U03qMoACQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:&=
#39;;return true;" onclick=3D"this.href=3D'javascript:';return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"1U03qMoACQAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
;javascript:';return true;">std-pr...@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/78d38a05-9633-43af-a04f-7a3895b72d53%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D'https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/78d38a05-9633-43af-a04f-7a3895b72d53%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter';return true;" on=
click=3D"this.href=3D'https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/78d38a05-9633-43af-a04f-7a3895b72d53%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter';return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/78d38a05-9633-43af-<wbr>a04f-=
7a3895b72d53%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/ced4dd3b-4eaa-4e41-a91f-b78e40564933%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ced4dd3b-4eaa-4e41-a91f-b78e40564933=
%40isocpp.org</a>.<br />
------=_Part_32694_1090087564.1526409449703--
------=_Part_32693_1841917422.1526409449703--
.
Author: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Date: Tue, 15 May 2018 19:48:01 +0100
Raw View
--000000000000eb7590056c430b4e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Noted, thank you.
This is a very interesting proposal, but I think it's a bit much to bite
off all at the same time, especially since it basically really does seem
like it's standardizing a macro.
Imagine, like in your example, you want to bind vector.push_back.
vector::push_back is a template - it does not have a first-class member at
all, which means you are effectively taking tokens, generating a lambda
using tokens (and not a pointer) and then calling it by name (and not some
other way). It does strictly more than std::bind would, for instance.
I'd also like to see some investigation about what this syntax could
conflict with, and which doors it closes in the future.
I'd like to see some interaction with the current "better-macros" proposals
(lazy parameters, for instance) to see if this is implementable with them,
or, if not, if it could be.
Other than that, looks good at first glance! That's about as far as I'm
willing to go without the above, though :). We know this automatic binding
works well in python, but the differences are large (python does not have
overload sets).
G
On Tue, May 15, 2018 at 7:37 PM, Antonio Perez <antonio@perezexcelsior.com>
wrote:
> I am aware of std::invoke.
>
> The goal of my proposed addition is to make it easier to use member
> functions as callable objects. Currently you have to pass a pointer to th=
e
> member function, as well as an object to call it on (meaning that higher
> order functions need additional overloads just to work with member
> functions). Why not allow passing the object and it's member function
> together as single callable object?
>
> On Tuesday, May 15, 2018 at 11:14:44 AM UTC-6, Ga=C5=A1per A=C5=BEman wro=
te:
>>
>> Just a question - are you aware of std::invoke?
>>
>> http://en.cppreference.com/w/cpp/utility/functional/invoke
>>
>>
>> G
>>
>> On Tue, May 15, 2018 at 6:09 PM, Antonio Perez <ant...@perezexcelsior.co=
m
>> > wrote:
>>
>>> *Proposal: *Allow member functions to be used as though "wrapped" in a
>>> lambda.
>>>
>>> To get a clearer picture of what this means, let's define a macro that
>>> wraps the input in a lambda:
>>> #define LAMBDA(x) [&](auto&&... inputs) { return x(inputs...); }
>>> (I an *not* proposing adding this macro to the standard, but rather
>>> using it to define the behavior of my proposed syntax)
>>>
>>> If someone writes:
>>> std::vector<int> v;
>>> auto func =3D v.push_back; //Proposed syntax
>>> This should be equivalent to:
>>> std::vector<int> v;
>>> //This will compile if LAMBDA is defined as above
>>> auto func =3D LAMBDA(v.push_back);
>>>
>>> It should also be possible to pass member functions to higher order
>>> functions:
>>>
>>> template<class Func,class... Args>
>>> void RepeatNTimes(size_t n, Func&& function,Args&&... arguments) {
>>> for(size_t i=3D0;i<n;++i) {
>>> function(arguments...);
>>> }
>>> }
>>> //...
>>> //Later in the code:
>>>
>>> std::vector<int> v {};
>>> RepeatNTimes(5, v.push_back, 0); //Proposed syntax
>>> //v now equals {0, 0, 0, 0, 0}
>>>
>>> That last line would equivalent to:
>>> RepeatNTimes(5, LAMBDA(v.push_back), 0);//This will compile if LAMBDA
>>> is defined as above
>>>
>>> *Sales Pitch: *C++ is powerful precisely because it allows abstraction
>>> with minimal overhead. Thanks to highly aggressive compiler optimizatio=
n,
>>> it's easy to write short, understandable, and expressive code that's al=
so
>>> fast.
>>>
>>> Member function are currently cumbersome to use with higher order
>>> functions, and their current syntax is complicated. Making it easy to p=
ass
>>> member functions would add to the flexibility and power of C++, and wou=
ld
>>> also make the syntax more uniform. Function pointers, lambdas, and func=
tors
>>> can already be passed and assigned with the proposed syntax; why not me=
mber
>>> functions too?
>>>
>>> --
>>> 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-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit https://groups.google.com/a/is
>>> ocpp.org/d/msgid/std-proposals/78d38a05-9633-43af-a04f-
>>> 7a3895b72d53%40isocpp.org
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/78d38a05-=
9633-43af-a04f-7a3895b72d53%40isocpp.org?utm_medium=3Demail&utm_source=3Dfo=
oter>
>>> .
>>>
>>
>> --
> 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/ced4dd3b-4eaa-4e41-
> a91f-b78e40564933%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ced4dd3b-4e=
aa-4e41-a91f-b78e40564933%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAANG%3DkXZGfU4FHzFFVqE8hB8FPGU_hYheaJXp4daFR-eG=
WJd0g%40mail.gmail.com.
--000000000000eb7590056c430b4e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Noted, thank you.<div><br></div><div>This is a very intere=
sting proposal, but I think it's a bit much to bite off all at the same=
time, especially since it basically really does seem like it's standar=
dizing a macro.</div><div><br></div><div>Imagine, like in your example, you=
want to bind vector.push_back. vector::push_back is a template - it does n=
ot have a first-class member at all, which means you are effectively taking=
tokens, generating a lambda using tokens (and not a pointer) and then call=
ing it by name (and not some other way). It does strictly more than std::bi=
nd would, for instance.</div><div><br></div><div>I'd also like to see s=
ome investigation about what this syntax could conflict with, and which doo=
rs it closes in the future.</div><div><br></div><div>I'd like to see so=
me interaction with the current "better-macros" proposals (lazy p=
arameters, for instance) to see if this is implementable with them, or, if =
not, if it could be.</div><div><br></div><div>Other than that, looks good a=
t first glance! That's about as far as I'm willing to go without th=
e above, though :). We know this automatic binding works well in python, bu=
t the differences are large (python does not have overload sets).</div><div=
><br></div><div>G</div></div><div class=3D"gmail_extra"><br><div class=3D"g=
mail_quote">On Tue, May 15, 2018 at 7:37 PM, Antonio Perez <span dir=3D"ltr=
"><<a href=3D"mailto:antonio@perezexcelsior.com" target=3D"_blank">anton=
io@perezexcelsior.com</a>></span> wrote:<br><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x"><div dir=3D"ltr">I am aware of std::invoke.<div><br></div><div>The goal =
of my proposed addition is to make it easier to use member functions as cal=
lable objects. Currently you have to pass a pointer to the member function,=
as well as an object to call it on (meaning that higher order functions ne=
ed additional overloads just to work with member functions). Why not allow =
passing the object and it's member function together as single callable=
object?<br><div><span class=3D"gmail-"><br>On Tuesday, May 15, 2018 at 11:=
14:44 AM UTC-6, Ga=C5=A1per A=C5=BEman wrote:</span><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex"><span class=3D"gmail-"><div dir=3D"ltr">Just a q=
uestion - are you aware of std::invoke?<div><br></div><div><a href=3D"http:=
//en.cppreference.com/w/cpp/utility/functional/invoke" rel=3D"nofollow" tar=
get=3D"_blank">http://en.cppreference.com/w/c<wbr>pp/utility/functional/inv=
oke</a></div><div><br></div><div><br></div><div>G</div></div></span><div><b=
r><div class=3D"gmail_quote"><div><div class=3D"gmail-h5">On Tue, May 15, 2=
018 at 6:09 PM, Antonio Perez <span dir=3D"ltr"><<a rel=3D"nofollow">ant=
....@perezexcelsior.com</a>></span> wrote:<br></div></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex"><div><div class=3D"gmail-h5"><div dir=3D=
"ltr"><div><b>Proposal:=C2=A0</b>Allow member functions to be used as thoug=
h "wrapped" in a lambda.=C2=A0</div><div><br></div><div>To get a =
clearer picture of what this means, let's define a macro that wraps the=
input in a lambda:</div><div><div style=3D"background-color:rgb(250,250,25=
0);border:1px solid rgb(187,187,187);word-wrap:break-word"><code><div><span=
style=3D"color:rgb(136,0,0)">#define</span><span style=3D"color:rgb(0,0,0)=
"> LAMBDA</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D=
"color:rgb(0,0,0)">x</span><span style=3D"color:rgb(102,102,0)">)</span><sp=
an style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">=
[&](</span><span style=3D"color:rgb(0,0,136)">auto</span><span style=3D=
"color:rgb(102,102,0)">&&...</span><span style=3D"color:rgb(0,0,0)"=
> inputs</span><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"=
color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</span><spa=
n style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">ret=
urn</span><span style=3D"color:rgb(0,0,0)"> x</span><span style=3D"color:rg=
b(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">inputs</span><span s=
tyle=3D"color:rgb(102,102,0)">...);</span><span style=3D"color:rgb(0,0,0)">=
</span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:r=
gb(0,0,0)"><br></span></div></code></div><div>(I an <i>not</i>=C2=A0proposi=
ng adding this macro to the standard, but rather using it to define the beh=
avior of my proposed syntax)</div><div><br></div>If someone writes:</div><d=
iv><div style=3D"background-color:rgb(250,250,250);border:1px solid rgb(187=
,187,187);word-wrap:break-word"><code><div><font><span style=3D"color:rgb(0=
,0,0)">std</span><span style=3D"color:rgb(102,102,0)">::</span><span style=
=3D"color:rgb(0,0,0)">vector</span><span style=3D"color:rgb(0,136,0)"><i=
nt></span><span style=3D"color:rgb(0,0,0)"> v</span><span style=3D"color=
:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br></span><span =
style=3D"color:rgb(0,0,136)">auto</span><font color=3D"#000000"><span><span=
style=3D"color:rgb(0,0,0)"> func </span><span style=3D"color:rgb(102,102,0=
)">=3D</span><span style=3D"color:rgb(0,0,0)"> v</span><span style=3D"color=
:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">push_back</span><=
span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)=
"> </span><span style=3D"color:rgb(136,0,0)">//Proposed syntax</span></span=
></font></font></div></code></div>This should be equivalent to:</div><div><=
div style=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187=
,187);word-wrap:break-word"><code><div><span style=3D"color:rgb(0,0,0)">std=
</span><span style=3D"color:rgb(102,102,0)">::</span><span style=3D"color:r=
gb(0,0,0)">vector</span><span style=3D"color:rgb(0,136,0)"><int></spa=
n><font color=3D"#000000"><span style=3D"color:rgb(0,0,0)"> v</span><span s=
tyle=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=
</span><span style=3D"color:rgb(136,0,0)">//This will compile if LAMBDA is =
defined as above</span><span style=3D"color:rgb(0,0,0)"><br></span><span><s=
pan style=3D"color:rgb(0,0,136)">auto</span><span style=3D"color:rgb(0,0,0)=
"> func </span><span style=3D"color:rgb(102,102,0)">=3D</span><span style=
=3D"color:rgb(0,0,0)"> LAMBDA</span><span style=3D"color:rgb(102,102,0)">(<=
/span><span style=3D"color:rgb(0,0,0)">v</span><span style=3D"color:rgb(102=
,102,0)">.</span><span style=3D"color:rgb(0,0,0)">push_back</span><span sty=
le=3D"color:rgb(102,102,0)">);</span></span></font></div></code></div><br>I=
t should also be possible to pass member functions to higher order function=
s:<br></div><div><br></div><div><div style=3D"background-color:rgb(250,250,=
250);border:1px solid rgb(187,187,187);word-wrap:break-word"><code><div><sp=
an style=3D"color:rgb(0,0,136)">template</span><span style=3D"color:rgb(102=
,102,0)"><</span><span style=3D"color:rgb(0,0,136)">class</span><span st=
yle=3D"color:rgb(0,0,0)"> </span><font><span style=3D"color:rgb(102,0,102)"=
>Func</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"col=
or:rgb(0,0,136)">class</span><span style=3D"color:rgb(102,102,0)">...</span=
><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,10=
2)">Args</span><span style=3D"color:rgb(102,102,0)">></span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)">void</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0=
,102)">RepeatNTimes</span><span style=3D"color:rgb(102,102,0)">(</span><spa=
n style=3D"color:rgb(0,0,0)">size_t n</span><span style=3D"color:rgb(102,10=
2,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color=
:rgb(102,0,102)">Func</span><span style=3D"color:rgb(102,102,0)">&&=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,=
0,136)">function</span><span style=3D"color:rgb(102,102,0)">,</span><span s=
tyle=3D"color:rgb(102,0,102)">Args</span><span style=3D"color:rgb(102,102,0=
)">&&...</span><span style=3D"color:rgb(0,0,0)"> arguments</span><s=
pan style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0)"=
> </span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:=
rgb(0,0,0)"><br>=C2=A0 =C2=A0</span><span style=3D"color:rgb(0,0,136)">for<=
/span><span style=3D"color:rgb(102,102,0)">(</span><font color=3D"#000000">=
<span><span style=3D"color:rgb(0,0,0)">size_t i</span><span style=3D"color:=
rgb(102,102,0)">=3D</span><span style=3D"color:rgb(0,102,102)">0</span><spa=
n style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)">i=
</span><span style=3D"color:rgb(102,102,0)"><</span><span style=3D"color=
:rgb(0,0,0)">n</span><span style=3D"color:rgb(102,102,0)">;++</span><span s=
tyle=3D"color:rgb(0,0,0)">i</span><span style=3D"color:rgb(102,102,0)">)</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,1=
02,0)">{</span><span style=3D"color:rgb(0,0,0)"><br></span></span></font><f=
ont color=3D"#666600"><span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0 =C2=A0=
</span><span style=3D"color:rgb(0,0,136)">function</span><span style=3D"co=
lor:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)">arguments</spa=
n><span style=3D"color:rgb(102,102,0)">...);</span><span style=3D"color:rgb=
(0,0,0)"><br>=C2=A0 =C2=A0</span><span style=3D"color:rgb(102,102,0)">}</sp=
an><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102=
,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D=
"color:rgb(136,0,0)">//...</span><span style=3D"color:rgb(0,0,0)"><br></spa=
n><span style=3D"color:rgb(136,0,0)">//Later in the code:</span><span style=
=3D"color:rgb(0,0,0)"><br><br></span></font><span style=3D"color:rgb(0,0,0)=
">std</span><span style=3D"color:rgb(102,102,0)">::</span><span style=3D"co=
lor:rgb(0,0,0)">vector</span><span style=3D"color:rgb(0,136,0)"><int>=
</span><span style=3D"color:rgb(0,0,0)"> v </span><span style=3D"color:rgb(=
102,102,0)">{};</span><span style=3D"color:rgb(0,0,0)"><br></span><span sty=
le=3D"color:rgb(102,0,102)">RepeatNTimes</span><span style=3D"color:rgb(102=
,102,0)">(</span><font color=3D"#006666"><span style=3D"color:rgb(0,102,102=
)">5</span></font><span style=3D"color:rgb(102,102,0)">,</span><span style=
=3D"color:rgb(0,0,0)"> v</span><span style=3D"color:rgb(102,102,0)">.</span=
><span style=3D"color:rgb(0,0,0)">push_back</span><span style=3D"color:rgb(=
102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D=
"color:rgb(0,102,102)">0</span><span style=3D"color:rgb(102,102,0)">);</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(136,0,0=
)">//Proposed syntax</span><span style=3D"color:rgb(0,0,0)"><br></span><spa=
n style=3D"color:rgb(136,0,0)">//v now equals {0, 0, 0, 0, 0}</span></font>=
</div></code></div><div><br></div><div>That last line would equivalent to:<=
/div><div><div style=3D"background-color:rgb(250,250,250);border:1px solid =
rgb(187,187,187);word-wrap:break-word"><code><div><font color=3D"#000000"><=
span style=3D"color:rgb(102,0,102)">RepeatNTimes</span><span style=3D"color=
:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,102,102)">5</span><span=
style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> L=
AMBDA</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"col=
or:rgb(0,0,0)">v</span><span style=3D"color:rgb(102,102,0)">.</span><span s=
tyle=3D"color:rgb(0,0,0)">push_back</span><span style=3D"color:rgb(102,102,=
0)">),</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:=
rgb(0,102,102)">0</span><span style=3D"color:rgb(102,102,0)">);</span></fon=
t><span style=3D"color:rgb(136,0,0)"><span style=3D"color:rgb(136,0,0)">//T=
his will compile if LAMBDA is defined as above</span></span></div></code></=
div><br><b>Sales Pitch:=C2=A0</b>C++ is powerful precisely because it allow=
s abstraction with minimal overhead. Thanks to highly aggressive compiler o=
ptimization, it's easy to write short, understandable, and expressive c=
ode that's also fast.</div></div><div><br></div><div>Member function ar=
e currently cumbersome to use with higher order functions, and their curren=
t syntax is complicated. Making it easy to pass member functions would add =
to the flexibility and power of C++, and would also make the syntax more un=
iform. Function pointers, lambdas, and functors can already be passed and a=
ssigned with the proposed syntax; why not member functions too?</div><span>=
<font color=3D"#888888"><div><br></div></font></span></div></div></div><spa=
n><font color=3D"#888888"><div><div class=3D"gmail-h5">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br></div></div>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<span class=3D"gmail-"><br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/78d38a05-9633-43af-a04f-7a3895b72d53%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-pr=
oposals<wbr>/78d38a05-9633-43af-a04f-<wbr>7a3895b72d53%40isocpp.org</a>.<br=
>
</span></font></span></blockquote></div><br></div>
</blockquote></div></div></div><span class=3D"gmail-">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ced4dd3b-4eaa-4e41-a91f-b78e40564933%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/ced4=
dd3b-4eaa-4e41-<wbr>a91f-b78e40564933%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAANG%3DkXZGfU4FHzFFVqE8hB8FPGU_hYhea=
JXp4daFR-eGWJd0g%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkXZGfU4=
FHzFFVqE8hB8FPGU_hYheaJXp4daFR-eGWJd0g%40mail.gmail.com</a>.<br />
--000000000000eb7590056c430b4e--
.
Author: Antonio Perez <antonio@perezexcelsior.com>
Date: Tue, 15 May 2018 12:32:32 -0700 (PDT)
Raw View
------=_Part_32720_1626101748.1526412752992
Content-Type: multipart/alternative;
boundary="----=_Part_32721_1225787674.1526412752994"
------=_Part_32721_1225787674.1526412752994
Content-Type: text/plain; charset="UTF-8"
Thank you for your feedback! I'd like to make one change to the original
post, and it's that arguments should be forwarded to ensure correct /
expected behavior (the way the lambda macro was written in the original
post, arguments weren't forwarded).
This code illustrates the difference between when arguments are and aren't
forwarded
//In Demo.cc:
#include <iostream>
#include <vector>
#include <functional>
#include <utility>
struct movable {
int id;
bool moved = false;
movable() {
static int num_created = 0;
id = num_created++;
std::cout << "[movable() called, id=" << id << "]" << std::endl;
}
movable(const movable& m) : id(m.id) {
std::cout << "[movable(const&) called, id=" << id << "]" << std::endl
;
}
movable(movable&& m) : id(m.id) {
m.moved = true;
std::cout << "[movable(&&) called, id=" << id << "]" << std::endl;
}
~movable() {
if(!moved) {
std::cout << "[~movable() called, id=" << id << "]" << std::endl;
}
}
};
void move_and_discard(movable& m) {
std::cout << "[recieved reference; didn't move]" << std::endl;
}
void move_and_discard(movable&& m) {
movable dest = std::move(m);
std::cout << "[moved object]" << std::endl;
}
int main() {
{
std::cout << "Direct call: " << std::endl;
movable A {};
move_and_discard(std::move(A));
}
{
auto move_and_discard_lambda = [](auto&&... inputs) {
move_and_discard(inputs...);
};
std::cout << "With lambda (unforwarded): " << std::endl;
movable B {};
move_and_discard_lambda(std::move(B));
}
{
auto move_and_discard_lambda = [](auto&&... inputs) {
move_and_discard(std::forward<decltype(inputs)>(inputs)...);
};
std::cout << "With lambda (forwarded): " << std::endl;
movable C {};
move_and_discard_lambda(std::move(C));
}
}/* Terminal output:
$ c++-7 -std=c++17 -O3 -pedantic -Wall Demo.cc -o Demo && ./Demo
Direct call:
[movable() called, id=0]
[movable(&&) called, id=0]
[moved object]
[~movable() called, id=0]
With lambda (unforwarded):
[movable() called, id=1]
[recieved reference; didn't move]
[~movable() called, id=1]
With lambda (forwarded):
[movable() called, id=2]
[movable(&&) called, id=2]
[moved object]
[~movable() called, id=2]
*/
--
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/49b86caf-1b7d-45dc-a044-34efe964ee38%40isocpp.org.
------=_Part_32721_1225787674.1526412752994
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thank you for your feedback! I'd like to make one chan=
ge to the original post, and it's that arguments should be forwarded to=
ensure correct / expected behavior (the way the lambda macro was written i=
n the original post, arguments weren't forwarded).=C2=A0<div><br><div>T=
his code illustrates the difference between when arguments are and aren'=
;t forwarded</div><div><div class=3D"prettyprint" style=3D"border: 1px soli=
d rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><div style=3D"font-family: Menlo, Monaco, &quo=
t;Courier New", monospace; font-size: 12px; line-height: 18px; white-s=
pace: pre; background-color: rgb(255, 255, 255);"><div><font color=3D"#6666=
00"><span style=3D"caret-color: rgb(102, 102, 0);"><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">//In Demo.cc:</span></span></font><font c=
olor=3D"#000000"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span></font><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>#include</span><span style=3D"color: rgb(158, 151, 113);"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span></span><span style=3D"col=
or: rgb(0, 255, 255);"><span style=3D"color: #080;" class=3D"styled-by-pret=
tify"><iostream></span></span></div><div style=3D"color: rgb(212, 212=
, 212);"><span style=3D"color: rgb(116, 151, 145);"><span style=3D"color: #=
800;" class=3D"styled-by-prettify">#include</span></span><span style=3D"col=
or: rgb(158, 151, 113);"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span></span><span style=3D"color: rgb(0, 255, 255);"><span style=
=3D"color: #080;" class=3D"styled-by-prettify"><vector></span></span>=
</div><div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: rgb(1=
16, 151, 145);"><span style=3D"color: #800;" class=3D"styled-by-prettify">#=
include</span></span><span style=3D"color: rgb(158, 151, 113);"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=
=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080;" class=3D"styled-=
by-prettify"><functional></span></span></div><div style=3D"color: rgb=
(212, 212, 212);"><span style=3D"color: rgb(116, 151, 145);"><span style=3D=
"color: #800;" class=3D"styled-by-prettify">#include</span></span><span sty=
le=3D"color: rgb(158, 151, 113);"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span></span><span style=3D"color: rgb(0, 255, 255);"><s=
pan style=3D"color: #080;" class=3D"styled-by-prettify"><utility></sp=
an></span></div><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span><div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: r=
gb(116, 151, 145);"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">struct</span></span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: rgb(174, 238, 149);"><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">movable</span></span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span></div><div style=3D"color: rgb(2=
12, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
=C2=A0 =C2=A0</span><span style=3D"color: rgb(116, 151, 145);"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span></span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> id</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span></div><div style=3D"color: =
rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> =C2=A0 =C2=A0</span><span style=3D"color: rgb(116, 151, 145);"><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">bool</span></span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> moved </span><span sty=
le=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">=3D</span></span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: rgb(0, 255, 255);"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">false</span></span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span></div><div style=
=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> =C2=A0 =C2=A0</span><span style=3D"color: rgb(139, 238, 217=
);"><span style=3D"color: #000;" class=3D"styled-by-prettify">movable</span=
></span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span></div><div style=
=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: rgb=
(116, 151, 145);"><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>static</span></span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: rgb(116, 151, 145);"><span style=3D"color=
: #008;" class=3D"styled-by-prettify">int</span></span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> num_created </span><span style=3D"co=
lor: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span></span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: rgb(0, 255, 255);"><span style=3D"co=
lor: #066;" class=3D"styled-by-prettify">0</span></span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span></div><div style=3D"color: r=
gb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> =C2=A0 =C2=A0 =C2=A0 =C2=A0id </span><span style=3D"color: rgb(129, 198=
, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> num_cre=
ated</span><span style=3D"color: rgb(129, 198, 190);"><span style=3D"color:=
#660;" class=3D"styled-by-prettify">++</span></span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span></div><div style=3D"color: rgb(=
212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
=C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">cout </span><span style=3D"color: rgb(129, 198, 190);"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify"><<</span></span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080;" class=3D"styled-=
by-prettify">"[movable() called, id=3D"</span></span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><<</span></span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> id </span><span style=3D"color: rgb(129, 198, 190);"><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify"><<</span></span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: rgb(0, 255, 255);"><span style=3D"color: #080;" class=3D"styled-by-=
prettify">"]"</span></span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: rgb(129, 198, 190);"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><<</span></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;" class=3D"styled-by-prettify">endl</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">;</span></div><div style=3D"color:=
rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> =C2=A0 =C2=A0</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span></div><div style=3D"color: rgb(212, 212, 212);"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</span><span =
style=3D"color: rgb(139, 238, 217);"><span style=3D"color: #000;" class=3D"=
styled-by-prettify">movable</span></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: rgb(116, 151, 145);">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">const</span></spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> movable</span>=
<span style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&</span></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> m</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 style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: rgb(139, 238, 217);"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">id</span></span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">m</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">i=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{</span></div><div style=3D=
"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">cout </span><span style=3D"color: rgb(129, 198, 19=
0);"><span style=3D"color: #660;" class=3D"styled-by-prettify"><<</sp=
an></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080;" clas=
s=3D"styled-by-prettify">"[movable(const&) called, id=3D"</sp=
an></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><<</span></span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> id </span><span style=3D"color: rgb(129, 1=
98, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify"><&l=
t;</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080;=
" class=3D"styled-by-prettify">"]"</span></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(=
129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify">=
<<</span></span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">endl</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></div><=
div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span></div><div style=3D"color: rgb(212, 212=
, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =
=C2=A0</span><span style=3D"color: rgb(139, 238, 217);"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">movable</span></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">movable</span><span style=3D"color: rgb(1=
29, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
amp;&</span></span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> m</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an 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=
: rgb(139, 238, 217);"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">id</span></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">m</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify">id</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></div><div style=3D"color: rgb(212, 21=
2, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0=
=C2=A0 =C2=A0 =C2=A0m</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">.</span><span style=3D"color: rgb(255, 255, 255);"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">moved</span></span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span></span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: rgb(0, 255, 255);"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">true</span></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">;</span></div><div style=3D"color:=
rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">cout </span><span style=3D"color: rgb(129, 198, 190);"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify"><<</span></sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">"[movable(&&) called, id=3D"</span></sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"=
styled-by-prettify"><<</span></span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> id </span><span style=3D"color: rgb(129, 198, 190=
);"><span style=3D"color: #660;" class=3D"styled-by-prettify"><<</spa=
n></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080;" class=
=3D"styled-by-prettify">"]"</span></span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(129, 19=
8, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify"><<=
;</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">endl</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">;</span></div><div sty=
le=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> =C2=A0 =C2=A0</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">}</span></div><div style=3D"color: rgb(212, 212, 212);=
"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0<=
/span><span style=3D"color: rgb(139, 238, 217);"><span style=3D"color: #660=
;" class=3D"styled-by-prettify">~</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">movable</span></span><span style=3D"color: #660;" c=
lass=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></div><div style=3D"color: rgb(212, 212, 212);"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=
=A0</span><span style=3D"color: rgb(116, 151, 145);"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">if</span></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: rgb(129, 1=
98, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify">!</spa=
n></span><span style=3D"color: #000;" class=3D"styled-by-prettify">moved</s=
pan><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></div><div style=3D"col=
or: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">cout </span><span style=3D"color: rgb(12=
9, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;<</span></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: rgb(0, 255, 255);"><span style=3D"color: #=
080;" class=3D"styled-by-prettify">"[~movable() called, id=3D"</s=
pan></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify"><<</span></span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> id </span><span style=3D"color: rgb(129, =
198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify"><&=
lt;</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080=
;" class=3D"styled-by-prettify">"]"</span></span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb=
(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify"=
><<</span></span><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">endl</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></div>=
<div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">}</span></div><div style=3D"colo=
r: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> =C2=A0 =C2=A0</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">}</span></div><div style=3D"color: rgb(212, 212, 212);"><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">};</span></div><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span><div style=3D"co=
lor: rgb(212, 212, 212);"><span style=3D"color: rgb(116, 151, 145);"><span =
style=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: rgb(139, 238, 217);"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">move_and_discard</span></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">movable</span><span style=3D"color: rgb(129, 198, 190);"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&</span></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> m</span><span st=
yle=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></div><div style=3D"color: rgb(212,=
212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=
=A0 =C2=A0std</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">cout =
</span><span style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"><<</span></span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(0, =
255, 255);"><span style=3D"color: #080;" class=3D"styled-by-prettify">"=
;[recieved reference; didn't move]"</span></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(=
129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify">=
<<</span></span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">endl</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></div><=
div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span></div><div style=3D"color: rgb(212, 212, 21=
2);"><span style=3D"color: rgb(116, 151, 145);"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">void</span></span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(139, 238,=
217);"><span style=3D"color: #000;" class=3D"styled-by-prettify">move_and_=
discard</span></span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">movab=
le</span><span style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&&</span></span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> m</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: #660;" class=3D"styl=
ed-by-prettify">{</span></div><div style=3D"color: rgb(212, 212, 212);"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0movabl=
e dest </span><span style=3D"color: rgb(129, 198, 190);"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span></span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(1=
39, 238, 217);"><span style=3D"color: #000;" class=3D"styled-by-prettify">s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">move</span></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">m</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">);</span></div><div style=3D"colo=
r: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> =C2=A0 =C2=A0std</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">cout </span><span style=3D"color: rgb(129, 198, 190);"><span style=3D=
"color: #660;" class=3D"styled-by-prettify"><<</span></span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: rgb(0, 255, 255);"><span style=3D"color: #080;" class=3D"styled-by-pret=
tify">"[moved object]"</span></span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(129, 198, 19=
0);"><span style=3D"color: #660;" class=3D"styled-by-prettify"><<</sp=
an></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">endl</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span></div><div style=3D=
"color: rgb(212, 212, 212);"><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">}</span></div><div style=3D"color: rgb(212, 212, 212);"><span s=
tyle=3D"color: rgb(116, 151, 145);"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">int</span></span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: rgb(139, 238, 217);"><span=
style=3D"color: #000;" class=3D"styled-by-prettify">main</span></span><spa=
n 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></div><div style=3D"color: rg=
b(212, 212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> =C2=A0 =C2=A0</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">{</span></div><div style=3D"color: rgb(212, 212, 212);"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0=
std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">cout </span><sp=
an style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><<</span></span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(0, 255, 255)=
;"><span style=3D"color: #080;" class=3D"styled-by-prettify">"Direct c=
all: "</span></span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: rgb(129, 198, 190);"><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify"><<</span></span><span style=
=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">endl</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span></div><div style=3D"color: rgb(212, 212,=
212);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =
=C2=A0 =C2=A0 =C2=A0movable A </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">{};</span></div><div style=3D"color: rgb(212, 212, 212)=
;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0=
=C2=A0 =C2=A0</span><span style=3D"color: rgb(139, 238, 217);"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">move_and_discard</span></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span s=
tyle=3D"color: rgb(139, 238, 217);"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">move</span></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">A</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">));</span></d=
iv><div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> =C2=A0 =C2=A0</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">}</span></div><div style=3D"color: rgb(212,=
212, 212);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=
=A0 =C2=A0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
{</span></div><div style=3D"color: rgb(212, 212, 212);"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><=
span style=3D"color: rgb(116, 151, 145);"><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">auto</span></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> move_and_discard_lambda </span><span style=3D"co=
lor: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span></span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
[](</span><span style=3D"color: rgb(116, 151, 145);"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">auto</span></span><span style=3D"color:=
rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&&</span></span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: rgb(255, 255, 255);"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">inputs</span></span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span></div><div style=3D"color: rgb(212, 212, 21=
2);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: rgb(139, 238, 2=
17);"><span style=3D"color: #000;" class=3D"styled-by-prettify">move_and_di=
scard</span></span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">inputs<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">...);</span=
></div><div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">};</span></div><div style=
=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">cout </span><span style=3D"color: rgb(129, 198,=
190);"><span style=3D"color: #660;" class=3D"styled-by-prettify"><<<=
/span></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: rgb(0, 255, 255);"><span style=3D"color: #080;" c=
lass=3D"styled-by-prettify">"With lambda (unforwarded): "</span><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><<</span></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;" class=3D"styl=
ed-by-prettify">endl</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span></div><div style=3D"color: rgb(212, 212, 212);"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=
=A0movable B </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{};</span></div><div style=3D"color: rgb(212, 212, 212);"><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</s=
pan><span style=3D"color: rgb(139, 238, 217);"><span style=3D"color: #000;"=
class=3D"styled-by-prettify">move_and_discard_lambda</span></span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: rgb(139, 238, 217);"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">move</=
span></span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">B</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">));</span></div><div st=
yle=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> =C2=A0 =C2=A0</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span></div><div style=3D"color: rgb(212, 212, 21=
2);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=
=A0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
></div><div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span st=
yle=3D"color: rgb(116, 151, 145);"><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">auto</span></span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> move_and_discard_lambda </span><span style=3D"color: rg=
b(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify=
">=3D</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">[](</sp=
an><span style=3D"color: rgb(116, 151, 145);"><span style=3D"color: #008;" =
class=3D"styled-by-prettify">auto</span></span><span style=3D"color: rgb(12=
9, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify">&a=
mp;&</span></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: rgb(255, 255, 255);"><span style=3D"color: #000=
;" class=3D"styled-by-prettify">inputs</span></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">{</span></div><div style=3D"color: rgb(212, 212, 212);"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: rgb(139, 238, 217);"><=
span style=3D"color: #000;" class=3D"styled-by-prettify">move_and_discard</=
span></span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">forward</span><span style=3D=
"color: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-b=
y-prettify"><</span></span><span style=3D"color: rgb(139, 238, 217);"><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">decltype</span></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">inputs</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: rgb(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">></span></span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">i=
nputs</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)...)=
;</span></div><div style=3D"color: rgb(212, 212, 212);"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">};</span></div><di=
v style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">cout </span><span style=3D"color: rg=
b(129, 198, 190);"><span style=3D"color: #660;" class=3D"styled-by-prettify=
"><<</span></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: rgb(0, 255, 255);"><span style=3D"colo=
r: #080;" class=3D"styled-by-prettify">"With lambda (forwarded): "=
;</span></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: rgb(129, 198, 190);"><span style=3D"color: #660=
;" class=3D"styled-by-prettify"><<</span></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;" class=
=3D"styled-by-prettify">endl</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span></div><div style=3D"color: rgb(212, 212, 212);"><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=
=A0 =C2=A0movable C </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{};</span></div><div style=3D"color: rgb(212, 212, 212);"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =
=C2=A0</span><span style=3D"color: rgb(139, 238, 217);"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">move_and_discard_lambda</span></span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span st=
yle=3D"color: rgb(139, 238, 217);"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">move</span></span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">C</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">));</span></di=
v><div style=3D"color: rgb(212, 212, 212);"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> =C2=A0 =C2=A0</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">}</span></div><div style=3D"color: rgb(212, =
212, 212);"><span style=3D"color: #660;" class=3D"styled-by-prettify">}</sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">/* Terminal ou=
tput:<br>$ c++-7 -std=3Dc++17 -O3 -pedantic -Wall Demo.cc -o Demo &&=
; ./Demo<br>Direct call:<br>[movable() called, id=3D0]<br>[movable(&&am=
p;) called, id=3D0]<br>[moved object]<br>[~movable() called, id=3D0]<br>Wit=
h lambda (unforwarded):<br>[movable() called, id=3D1]<br>[recieved referenc=
e; didn't move]<br>[~movable() called, id=3D1]<br>With lambda (forwarde=
d):<br>[movable() called, id=3D2]<br>[movable(&&) called, id=3D2]<b=
r>[moved object]<br>[~movable() called, id=3D2]<br>*/</span></div></div></d=
iv></code></div><br>=C2=A0</div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/49b86caf-1b7d-45dc-a044-34efe964ee38%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/49b86caf-1b7d-45dc-a044-34efe964ee38=
%40isocpp.org</a>.<br />
------=_Part_32721_1225787674.1526412752994--
------=_Part_32720_1626101748.1526412752992--
.
Author: Richard Smith <richard@metafoo.co.uk>
Date: Tue, 15 May 2018 12:56:18 -0700
Raw View
--0000000000001d8ed6056c4400ec
Content-Type: text/plain; charset="UTF-8"
Please see:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3617.htm
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0119r2.pdf
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0382r0.html
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0834r0.html
On 15 May 2018 at 10:09, Antonio Perez <antonio@perezexcelsior.com> wrote:
> *Proposal: *Allow member functions to be used as though "wrapped" in a
> lambda.
>
> To get a clearer picture of what this means, let's define a macro that
> wraps the input in a lambda:
> #define LAMBDA(x) [&](auto&&... inputs) { return x(inputs...); }
> (I an *not* proposing adding this macro to the standard, but rather using
> it to define the behavior of my proposed syntax)
>
> If someone writes:
> std::vector<int> v;
> auto func = v.push_back; //Proposed syntax
> This should be equivalent to:
> std::vector<int> v;
> //This will compile if LAMBDA is defined as above
> auto func = LAMBDA(v.push_back);
>
> It should also be possible to pass member functions to higher order
> functions:
>
> template<class Func,class... Args>
> void RepeatNTimes(size_t n, Func&& function,Args&&... arguments) {
> for(size_t i=0;i<n;++i) {
> function(arguments...);
> }
> }
> //...
> //Later in the code:
>
> std::vector<int> v {};
> RepeatNTimes(5, v.push_back, 0); //Proposed syntax
> //v now equals {0, 0, 0, 0, 0}
>
> That last line would equivalent to:
> RepeatNTimes(5, LAMBDA(v.push_back), 0);//This will compile if LAMBDA is
> defined as above
>
> *Sales Pitch: *C++ is powerful precisely because it allows abstraction
> with minimal overhead. Thanks to highly aggressive compiler optimization,
> it's easy to write short, understandable, and expressive code that's also
> fast.
>
> Member function are currently cumbersome to use with higher order
> functions, and their current syntax is complicated. Making it easy to pass
> member functions would add to the flexibility and power of C++, and would
> also make the syntax more uniform. Function pointers, lambdas, and functors
> can already be passed and assigned with the proposed syntax; why not member
> functions too?
>
> --
> 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/78d38a05-9633-43af-
> a04f-7a3895b72d53%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/78d38a05-9633-43af-a04f-7a3895b72d53%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
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/CAOfiQqk%3Da%3DgOzvX02MCK6dq%2BW6bLp5wYkzfN8H2Vr%3DJ9tw--%3Dg%40mail.gmail.com.
--0000000000001d8ed6056c4400ec
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Please see:<div><br></div><div><a href=3D"http://www.open-=
std.org/jtc1/sc22/wg21/docs/papers/2013/n3617.htm">http://www.open-std.org/=
jtc1/sc22/wg21/docs/papers/2013/n3617.htm</a><br></div><div><a href=3D"http=
://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0119r2.pdf">http://www=
..open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0119r2.pdf</a><br></div><div=
><a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0382r0=
..html">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0382r0.html=
</a><br></div><div><a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/p=
apers/2017/p0834r0.html">http://www.open-std.org/jtc1/sc22/wg21/docs/papers=
/2017/p0834r0.html</a><br></div></div><div class=3D"gmail_extra"><br><div c=
lass=3D"gmail_quote">On 15 May 2018 at 10:09, Antonio Perez <span dir=3D"lt=
r"><<a href=3D"mailto:antonio@perezexcelsior.com" target=3D"_blank">anto=
nio@perezexcelsior.com</a>></span> wrote:<br><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><div><b>Proposal:=C2=A0</b>Allow member functions to b=
e used as though "wrapped" in a lambda.=C2=A0</div><div><br></div=
><div>To get a clearer picture of what this means, let's define a macro=
that wraps the input in a lambda:</div><div><div class=3D"m_-3105021775539=
898246prettyprint" style=3D"background-color:rgb(250,250,250);border:1px so=
lid rgb(187,187,187);word-wrap:break-word"><code class=3D"m_-31050217755398=
98246prettyprint"><div class=3D"m_-3105021775539898246subprettyprint"><span=
style=3D"color:#800" class=3D"m_-3105021775539898246styled-by-prettify">#d=
efine</span><span style=3D"color:#000" class=3D"m_-3105021775539898246style=
d-by-prettify"> LAMBDA</span><span style=3D"color:#660" class=3D"m_-3105021=
775539898246styled-by-prettify">(</span><span style=3D"color:#000" class=3D=
"m_-3105021775539898246styled-by-prettify">x</span><span style=3D"color:#66=
0" class=3D"m_-3105021775539898246styled-by-prettify">)</span><span style=
=3D"color:#000" class=3D"m_-3105021775539898246styled-by-prettify"> </span>=
<span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettif=
y">[&](</span><span style=3D"color:#008" class=3D"m_-310502177553989824=
6styled-by-prettify">auto</span><span style=3D"color:#660" class=3D"m_-3105=
021775539898246styled-by-prettify">&&...</span><span style=3D"color=
:#000" class=3D"m_-3105021775539898246styled-by-prettify"> inputs</span><sp=
an style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">=
)</span><span style=3D"color:#000" class=3D"m_-3105021775539898246styled-by=
-prettify"> </span><span style=3D"color:#660" class=3D"m_-31050217755398982=
46styled-by-prettify">{</span><span style=3D"color:#000" class=3D"m_-310502=
1775539898246styled-by-prettify"> </span><span style=3D"color:#008" class=
=3D"m_-3105021775539898246styled-by-prettify">return</span><span style=3D"c=
olor:#000" class=3D"m_-3105021775539898246styled-by-prettify"> x</span><spa=
n style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">(=
</span><span style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-=
prettify">inputs</span><span style=3D"color:#660" class=3D"m_-3105021775539=
898246styled-by-prettify">...);</span><span style=3D"color:#000" class=3D"m=
_-3105021775539898246styled-by-prettify"> </span><span style=3D"color:#660"=
class=3D"m_-3105021775539898246styled-by-prettify">}</span><span style=3D"=
color:#000" class=3D"m_-3105021775539898246styled-by-prettify"><br></span><=
/div></code></div><div>(I an <i>not</i>=C2=A0proposing adding this macro to=
the standard, but rather using it to define the behavior of my proposed sy=
ntax)</div><div><br></div>If someone writes:</div><div><div class=3D"m_-310=
5021775539898246prettyprint" style=3D"background-color:rgb(250,250,250);bor=
der:1px solid rgb(187,187,187);word-wrap:break-word"><code class=3D"m_-3105=
021775539898246prettyprint"><div class=3D"m_-3105021775539898246subprettypr=
int"><font><span style=3D"color:#000" class=3D"m_-3105021775539898246styled=
-by-prettify">std</span><span style=3D"color:#660" class=3D"m_-310502177553=
9898246styled-by-prettify">::</span><span style=3D"color:#000" class=3D"m_-=
3105021775539898246styled-by-prettify">vector</span><span style=3D"color:#0=
80" class=3D"m_-3105021775539898246styled-by-prettify"><int></span><s=
pan style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-prettify"=
> v</span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-=
by-prettify">;</span><span style=3D"color:#000" class=3D"m_-310502177553989=
8246styled-by-prettify"><br></span><span style=3D"color:#008" class=3D"m_-3=
105021775539898246styled-by-prettify">auto</span><font color=3D"#000000"><s=
pan><span style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-pre=
ttify"> func </span><span style=3D"color:#660" class=3D"m_-3105021775539898=
246styled-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_-310=
5021775539898246styled-by-prettify"> v</span><span style=3D"color:#660" cla=
ss=3D"m_-3105021775539898246styled-by-prettify">.</span><span style=3D"colo=
r:#000" class=3D"m_-3105021775539898246styled-by-prettify">push_back</span>=
<span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettif=
y">;</span><span style=3D"color:#000" class=3D"m_-3105021775539898246styled=
-by-prettify"> </span><span style=3D"color:#800" class=3D"m_-31050217755398=
98246styled-by-prettify">//Proposed syntax</span></span></font></font></div=
></code></div>This should be equivalent to:</div><div><div class=3D"m_-3105=
021775539898246prettyprint" style=3D"background-color:rgb(250,250,250);bord=
er:1px solid rgb(187,187,187);word-wrap:break-word"><code class=3D"m_-31050=
21775539898246prettyprint"><div class=3D"m_-3105021775539898246subprettypri=
nt"><span style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-pre=
ttify">std</span><span style=3D"color:#660" class=3D"m_-3105021775539898246=
styled-by-prettify">::</span><span style=3D"color:#000" class=3D"m_-3105021=
775539898246styled-by-prettify">vector</span><span style=3D"color:#080" cla=
ss=3D"m_-3105021775539898246styled-by-prettify"><int></span><font col=
or=3D"#000000"><span style=3D"color:#000" class=3D"m_-3105021775539898246st=
yled-by-prettify"> v</span><span style=3D"color:#660" class=3D"m_-310502177=
5539898246styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m=
_-3105021775539898246styled-by-prettify"><br></span><span style=3D"color:#8=
00" class=3D"m_-3105021775539898246styled-by-prettify">//This will compile =
if LAMBDA is defined as above</span><span style=3D"color:#000" class=3D"m_-=
3105021775539898246styled-by-prettify"><br></span><span><span style=3D"colo=
r:#008" class=3D"m_-3105021775539898246styled-by-prettify">auto</span><span=
style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-prettify"> f=
unc </span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled=
-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_-310502177553=
9898246styled-by-prettify"> LAMBDA</span><span style=3D"color:#660" class=
=3D"m_-3105021775539898246styled-by-prettify">(</span><span style=3D"color:=
#000" class=3D"m_-3105021775539898246styled-by-prettify">v</span><span styl=
e=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">.</span=
><span style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-pretti=
fy">push_back</span><span style=3D"color:#660" class=3D"m_-3105021775539898=
246styled-by-prettify">);</span></span></font></div></code></div><br>It sho=
uld also be possible to pass member functions to higher order functions:<br=
></div><div><br></div><div><div class=3D"m_-3105021775539898246prettyprint"=
style=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187,18=
7);word-wrap:break-word"><code class=3D"m_-3105021775539898246prettyprint">=
<div class=3D"m_-3105021775539898246subprettyprint"><span style=3D"color:#0=
08" class=3D"m_-3105021775539898246styled-by-prettify">template</span><span=
style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">&l=
t;</span><span style=3D"color:#008" class=3D"m_-3105021775539898246styled-b=
y-prettify">class</span><span style=3D"color:#000" class=3D"m_-310502177553=
9898246styled-by-prettify"> </span><font><span style=3D"color:#606" class=
=3D"m_-3105021775539898246styled-by-prettify">Func</span><span style=3D"col=
or:#660" class=3D"m_-3105021775539898246styled-by-prettify">,</span><span s=
tyle=3D"color:#008" class=3D"m_-3105021775539898246styled-by-prettify">clas=
s</span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by=
-prettify">...</span><span style=3D"color:#000" class=3D"m_-310502177553989=
8246styled-by-prettify"> </span><span style=3D"color:#606" class=3D"m_-3105=
021775539898246styled-by-prettify">Args</span><span style=3D"color:#660" cl=
ass=3D"m_-3105021775539898246styled-by-prettify">></span><span style=3D"=
color:#000" class=3D"m_-3105021775539898246styled-by-prettify"><br></span><=
span style=3D"color:#008" class=3D"m_-3105021775539898246styled-by-prettify=
">void</span><span style=3D"color:#000" class=3D"m_-3105021775539898246styl=
ed-by-prettify"> </span><span style=3D"color:#606" class=3D"m_-310502177553=
9898246styled-by-prettify">RepeatNTimes</span><span style=3D"color:#660" cl=
ass=3D"m_-3105021775539898246styled-by-prettify">(</span><span style=3D"col=
or:#000" class=3D"m_-3105021775539898246styled-by-prettify">size_t n</span>=
<span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettif=
y">,</span><span style=3D"color:#000" class=3D"m_-3105021775539898246styled=
-by-prettify"> </span><span style=3D"color:#606" class=3D"m_-31050217755398=
98246styled-by-prettify">Func</span><span style=3D"color:#660" class=3D"m_-=
3105021775539898246styled-by-prettify">&&</span><span style=3D"colo=
r:#000" class=3D"m_-3105021775539898246styled-by-prettify"> </span><span st=
yle=3D"color:#008" class=3D"m_-3105021775539898246styled-by-prettify">funct=
ion</span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-=
by-prettify">,</span><span style=3D"color:#606" class=3D"m_-310502177553989=
8246styled-by-prettify">Args</span><span style=3D"color:#660" class=3D"m_-3=
105021775539898246styled-by-prettify">&&...</span><span style=3D"co=
lor:#000" class=3D"m_-3105021775539898246styled-by-prettify"> arguments</sp=
an><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-pret=
tify">)</span><span style=3D"color:#000" class=3D"m_-3105021775539898246sty=
led-by-prettify"> </span><span style=3D"color:#660" class=3D"m_-31050217755=
39898246styled-by-prettify">{</span><span style=3D"color:#000" class=3D"m_-=
3105021775539898246styled-by-prettify"><br>=C2=A0 =C2=A0</span><span style=
=3D"color:#008" class=3D"m_-3105021775539898246styled-by-prettify">for</spa=
n><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prett=
ify">(</span><font color=3D"#000000"><span><span style=3D"color:#000" class=
=3D"m_-3105021775539898246styled-by-prettify">size_t i</span><span style=3D=
"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">=3D</span><=
span style=3D"color:#066" class=3D"m_-3105021775539898246styled-by-prettify=
">0</span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-=
by-prettify">;</span><span style=3D"color:#000" class=3D"m_-310502177553989=
8246styled-by-prettify">i</span><span style=3D"color:#660" class=3D"m_-3105=
021775539898246styled-by-prettify"><</span><span style=3D"color:#000" cl=
ass=3D"m_-3105021775539898246styled-by-prettify">n</span><span style=3D"col=
or:#660" class=3D"m_-3105021775539898246styled-by-prettify">;++</span><span=
style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-prettify">i<=
/span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-p=
rettify">)</span><span style=3D"color:#000" class=3D"m_-3105021775539898246=
styled-by-prettify"> </span><span style=3D"color:#660" class=3D"m_-31050217=
75539898246styled-by-prettify">{</span><span style=3D"color:#000" class=3D"=
m_-3105021775539898246styled-by-prettify"><br></span></span></font><font co=
lor=3D"#666600"><span style=3D"color:#000" class=3D"m_-3105021775539898246s=
tyled-by-prettify">=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008" c=
lass=3D"m_-3105021775539898246styled-by-prettify">function</span><span styl=
e=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">(</span=
><span style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-pretti=
fy">arguments</span><span style=3D"color:#660" class=3D"m_-3105021775539898=
246styled-by-prettify">...);</span><span style=3D"color:#000" class=3D"m_-3=
105021775539898246styled-by-prettify"><br>=C2=A0 =C2=A0</span><span style=
=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">}</span>=
<span style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-prettif=
y"><br></span><span style=3D"color:#660" class=3D"m_-3105021775539898246sty=
led-by-prettify">}</span><span style=3D"color:#000" class=3D"m_-31050217755=
39898246styled-by-prettify"><br></span><span style=3D"color:#800" class=3D"=
m_-3105021775539898246styled-by-prettify">//...</span><span style=3D"color:=
#000" class=3D"m_-3105021775539898246styled-by-prettify"><br></span><span s=
tyle=3D"color:#800" class=3D"m_-3105021775539898246styled-by-prettify">//La=
ter in the code:</span><span style=3D"color:#000" class=3D"m_-3105021775539=
898246styled-by-prettify"><br><br></span></font><span style=3D"color:#000" =
class=3D"m_-3105021775539898246styled-by-prettify">std</span><span style=3D=
"color:#660" class=3D"m_-3105021775539898246styled-by-prettify">::</span><s=
pan style=3D"color:#000" class=3D"m_-3105021775539898246styled-by-prettify"=
>vector</span><span style=3D"color:#080" class=3D"m_-3105021775539898246sty=
led-by-prettify"><int></span><span style=3D"color:#000" class=3D"m_-3=
105021775539898246styled-by-prettify"> v </span><span style=3D"color:#660" =
class=3D"m_-3105021775539898246styled-by-prettify">{};</span><span style=3D=
"color:#000" class=3D"m_-3105021775539898246styled-by-prettify"><br></span>=
<span style=3D"color:#606" class=3D"m_-3105021775539898246styled-by-prettif=
y">RepeatNTimes</span><span style=3D"color:#660" class=3D"m_-31050217755398=
98246styled-by-prettify">(</span><font color=3D"#006666"><span style=3D"col=
or:#066" class=3D"m_-3105021775539898246styled-by-prettify">5</span></font>=
<span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettif=
y">,</span><span style=3D"color:#000" class=3D"m_-3105021775539898246styled=
-by-prettify"> v</span><span style=3D"color:#660" class=3D"m_-3105021775539=
898246styled-by-prettify">.</span><span style=3D"color:#000" class=3D"m_-31=
05021775539898246styled-by-prettify">push_back</span><span style=3D"color:#=
660" class=3D"m_-3105021775539898246styled-by-prettify">,</span><span style=
=3D"color:#000" class=3D"m_-3105021775539898246styled-by-prettify"> </span>=
<span style=3D"color:#066" class=3D"m_-3105021775539898246styled-by-prettif=
y">0</span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled=
-by-prettify">);</span><span style=3D"color:#000" class=3D"m_-3105021775539=
898246styled-by-prettify"> </span><span style=3D"color:#800" class=3D"m_-31=
05021775539898246styled-by-prettify">//Proposed syntax</span><span style=3D=
"color:#000" class=3D"m_-3105021775539898246styled-by-prettify"><br></span>=
<span style=3D"color:#800" class=3D"m_-3105021775539898246styled-by-prettif=
y">//v now equals {0, 0, 0, 0, 0}</span></font></div></code></div><div><br>=
</div><div>That last line would equivalent to:</div><div><div class=3D"m_-3=
105021775539898246prettyprint" style=3D"background-color:rgb(250,250,250);b=
order:1px solid rgb(187,187,187);word-wrap:break-word"><code class=3D"m_-31=
05021775539898246prettyprint"><div class=3D"m_-3105021775539898246subpretty=
print"><font color=3D"#000000"><span style=3D"color:#606" class=3D"m_-31050=
21775539898246styled-by-prettify">RepeatNTimes</span><span style=3D"color:#=
660" class=3D"m_-3105021775539898246styled-by-prettify">(</span><span style=
=3D"color:#066" class=3D"m_-3105021775539898246styled-by-prettify">5</span>=
<span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-prettif=
y">,</span><span style=3D"color:#000" class=3D"m_-3105021775539898246styled=
-by-prettify"> LAMBDA</span><span style=3D"color:#660" class=3D"m_-31050217=
75539898246styled-by-prettify">(</span><span style=3D"color:#000" class=3D"=
m_-3105021775539898246styled-by-prettify">v</span><span style=3D"color:#660=
" class=3D"m_-3105021775539898246styled-by-prettify">.</span><span style=3D=
"color:#000" class=3D"m_-3105021775539898246styled-by-prettify">push_back</=
span><span style=3D"color:#660" class=3D"m_-3105021775539898246styled-by-pr=
ettify">),</span><span style=3D"color:#000" class=3D"m_-3105021775539898246=
styled-by-prettify"> </span><span style=3D"color:#066" class=3D"m_-31050217=
75539898246styled-by-prettify">0</span><span style=3D"color:#660" class=3D"=
m_-3105021775539898246styled-by-prettify">);</span></font><span style=3D"co=
lor:rgb(136,0,0)"><span style=3D"color:#800" class=3D"m_-310502177553989824=
6styled-by-prettify">//This will compile if LAMBDA is defined as above</spa=
n></span></div></code></div><br><b>Sales Pitch:=C2=A0</b>C++ is powerful pr=
ecisely because it allows abstraction with minimal overhead. Thanks to high=
ly aggressive compiler optimization, it's easy to write short, understa=
ndable, and expressive code that's also fast.</div></div><div><br></div=
><div>Member function are currently cumbersome to use with higher order fun=
ctions, and their current syntax is complicated. Making it easy to pass mem=
ber functions would add to the flexibility and power of C++, and would also=
make the syntax more uniform. Function pointers, lambdas, and functors can=
already be passed and assigned with the proposed syntax; why not member fu=
nctions too?</div><span class=3D"HOEnZb"><font color=3D"#888888"><div><br><=
/div></font></span></div><span class=3D"HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/78d38a05-9633-43af-a04f-7a3895b72d53%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/78d3=
8a05-9633-43af-<wbr>a04f-7a3895b72d53%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAOfiQqk%3Da%3DgOzvX02MCK6dq%2BW6bLp5=
wYkzfN8H2Vr%3DJ9tw--%3Dg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Df=
ooter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOfiQq=
k%3Da%3DgOzvX02MCK6dq%2BW6bLp5wYkzfN8H2Vr%3DJ9tw--%3Dg%40mail.gmail.com</a>=
..<br />
--0000000000001d8ed6056c4400ec--
.