
Peter Dimov wrote:
Mathias Gaunard wrote:
Andy Venikov a écrit :
I'm not going to debate whether it's right or wrong, but I'm still curious - why did it have to be a template? When bind() is called it already has all the information about the function's signature
Not in the general case. For function pointers or member function pointers, I suppose it is the case though.
It's not possible in general for function pointers either.
void f( X x, Y y );
bind( f, _1, _1 ); //?
Do you mean to say that there may be a type that converts to both X and Y, but X and Y don't convert between each other? Yup. There's a problem. So it looks like templates are necessary. But are unconstrained templates necessary? Couldn't we put a concept check to enable templates only if underlying function/functor is callable with the given arguments. Something to what Eric Niebler proposed in another thread? ("How to detect if f() returns void"). Thanks, Andy.