SFINAE

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Oct 5 16:57:15 PDT 2008


On Sun, Oct 5, 2008 at 7:45 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> 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.

I was figuring this was how it would be unified.  Template
specialization has more than enough power to do function overloading.



More information about the Digitalmars-d mailing list