C++ Logo

std-proposals

Advanced search

Re: Template qualifiers

From: Phil Bouchard <phil_at_[hidden]>
Date: Fri, 4 Oct 2019 12:29:23 -0400
On 10/4/19 11:31 AM, Phil Bouchard wrote:
> Personally I'm not sure about P0847
> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0847r2.html#name-lookup-candidate-functions),
> because it seems to apply to "this" only whereas my goal is to stay
> generic, extensible and use a pretty syntax as much as possible.


To go back on P0847, it reminds me of a GCC extension where we can
convert a pointer-to-member-function to a pointer-to-global-function and
extract the "this" parameter:

https://gcc.gnu.org/onlinedocs/gcc/Bound-member-functions.html#Bound-member-functions

Might as well standardize this extension, no?

For the recursive lambda, a lambda really is a syntactic sugar form of a
functor so why not imply operator () quite simply?

auto fib = [](int n)
{
     if (n < 2) return n;
     return operator () (n-1) + operator () (n-2);
};

I might miss something but this is on top of my head.


-- 
*Phil Bouchard*
Founder
C.: (819) 328-4743
Fornux Logo <http://www.fornux.com>

Received on 2019-10-04 11:31:36