A little bit of a workaround, but this will work:
import std.traits;
template bound(alias min, alias max, bool Exceptional = true)
if (!is(CommonType!(typeof(min), typeof(max)) == void))
{
auto bound(CommonType!(typeof(min), typeof(max)) value) {
return Bound!(typeof(value), min, max, Exceptional)(value);
}
}
And it works like this:
void main()
{
auto a = bound!(0.0f, 2.0f)(1.0f);
auto b = bound!(0, 2)(1);
import std.stdio;
writeln(typeof(a).stringof); // Bound!(float, 0.00000F, 2.00000F, true)
writeln(typeof(b).stringof); // Bound!(int, 0, 2, true)
}