C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Template qualifiers
From: Phil Bouchard (phil_at_[hidden])
Date: 2019-10-04 11:29:23


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>


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups