For your example to work with template constraints, the most straightforward solution would bevoid 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