SFINAE
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Oct 5 16:45:52 PDT 2008
Jason House wrote:
> Andrei Alexandrescu wrote:
>
>> I think conditional templates obviate most, if not all, of the need for
>> sfinae. There need to be some more steps taken, most importantly
>> unification of regular functions with template functions.
>>
>> Andrei at home
>
> Can you expand on the "unification of regular functions with template
> functions"?
This is a large subject and I don't want to spread myself too thin. In
short:
void fun(int a, char[] b);
should be treated as if it were declared:
void fun(T, U)(T a, U b) if (is(T == int) && is(U == char[]));
In other words: a regular function is nothing but an "infinitely
specialized" template function.
Once that's in place, they'll all play rather nicely together. But there
are some more things to change, such as behavior of template functions
with implicit conversions.
Andrei
More information about the Digitalmars-d
mailing list