On Monday, 21 December 2015 at 11:07:16 UTC, Jonathan M Davis wrote:
For your example to work with template constraints, the most straightforward solution would be

void func(T)(T t)
    if(!isIntegral!T)
{
    writeln(1);
}

void func(T)(T t)
    if(isIntegral!T)
{
    writeln(2);
}

Alternatively, you can use static if, though you're only dealing with one template in that case. e.g.

void func(T)(T t)
{
    static if(isIntegral!T)
        writeln(2);
    else
        writeln(1);
}

- Jonathan M Davis

Reply via email to